Comments (10)
Again it's all about minimizing payload size. Currently, POST and PATCH responses only contain fields that the API updates for the client ('updated', 'created', '_id', 'etag', etc.). In case of a POST the client knows the other field values (it posted them). In case of a PATCH, the only issue could be the with the 'etag' being in the header and not in the payload (we discussed this in #29). Since a client must provide the previous 'etag' in order to successfully patch, it is assumed that it knows the item already. An eventual 'COHERENCE_MODE` setting (as discussed in #29) could also fill PATCH/POST responses with all the extra fields I guess.
from eve.
Agree. The main issue is that there is no etag at all returned from POST...
from eve.
Right!
from eve.
from eve.
Thank you @hluz, by addressing your PRs I also got the chance to improve performance, especially with multiple document insertions (but also on PATCH), and refactor some things I didn't like in my code.
from eve.
AngularJS/resource could definitely make use of this "COHERENCE MODE." Although a valid 'If-Match' header / etag means that the client already has the latest data, AngularJS/resource completely overwrites the object with the response. The correct solution is to make AngularJS/resource aware of this, but it sure would be nice just to flick on this mode...
from eve.
@nicolaiarocci I'd like you to reconsider adding COHERENCE MODE
to Eve. I'm currently working with a framework (Ember.js, though I hear Angular also has this problem) where I have to jump through hoops in order to save my data correctly if the server does not respond with the full object after POST
.
Also, though it may seem like a waste of bandwidth because the client should 'know' what the values are, there may arise a situation (because of encoding or some other issue) where the POST
is completed successfully but the data on the server is slightly different from the data on the client. Returning the full object allows the client to be absolutely sure that it has the same data as the server.
from eve.
@nicolaiarocci, I'd like to submit a pull request for this feature in milestone 0.4.
from eve.
@jenmontes @joshvillbrandt would you please open a separate ticket for the COHERENCE_MODE
request? I'm willing to give it a spin, especially if Josh is going to PR it 👍
from eve.
BANDWIDTH_SAVER
flag has been implemented. When BANDWIDTH_SAVER == False
, the full response document is available including embedded documents and media files. I do not think projections are supported with the write verbs. Unit tests for embedded documents, media files, and projections were not added for the write verbs, but unit tests for basic fields were added.
By the way, I noticed that the self
HATEOAS field was populated using item_lookup_field
for GET and ID_FIELD
for POST. I'm not sure why that was different... I'm using ID_FIELD
in build_response_document()
.
from eve.
Related Issues (20)
- Is there a way to get jsonschema using the API? HOT 1
- Issue with query_objectid_as_string on Eve>=1.0.1 HOT 7
- Release HOT 1
- 422 UNPROCESSABLE ENTITY when using user_id and data_relation on PATCH HOT 1
- Render fails because recent version of Werkzeug has removed escape() method from utils HOT 6
- HATEOAS links are relative starting with Werkzeug 2.1; should be absolute for backward compatibility HOT 1
- Werkzeug utils has no attribute escape. HOT 1
- MongoDB auth related issue in MONGO_URI HOT 10
- Add support to release Linux aarch64 wheels HOT 2
- deleteitem_internal on media resource, KeyError: 'media'
- Tests fail with Flask 2.2 HOT 2
- etag generation fails if 'uuidRepresentation' is not set in MONGO_OPTIONS HOT 1
- Malformed Last Updated field HOT 7
- How to get in touch regarding a security concern HOT 1
- [Feature Request] One document Endpoint HOT 1
- pass var to a pipeline aggregation via url and regex HOT 1
- Replace vs Merge Update on PATCH
- CI failure: `mongo command not found` on ubuntu-latest (22.04)
- Tests folder in eve distribution HOT 3
- Type serialization does not work inside valuesrules or valueschema
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eve.