Giter Site home page Giter Site logo

Comments (5)

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

Hello and thank you for your comments. Both are actually design decisions taken to minimize payload size, which is an important factor when dealing with possibly unpredictable connections (think mobile).

If you're on a collection endpoint, by definition you already know the documents parent (you're on it). Besides, that piece of information is actually in the payload already (the "self" link in _items). Repeating that link for every document in the payload seems like an optimization waste. Consider that there could be hundreds (or even thousands) duplicates in case the API maintainer, for some obscure reason, decides to turn pagination off.

For the same reason the etag is not duplicated at the item endpoint. It's in the header already, you don't probably need that piece of information twice within the same payload. At collection endpoint we're forced to serve individual etags since we want to allow for subsequent direct conditional requests (If-Match) on individual documents, without forcing a previous document lookup. For coherence however, it would probably be reasonable to add the etag in the json/xml stream too, as in this case the 'waste' would be pretty much insignificant. Let's see what/if others have something to say on this point.

from eve.

hluz avatar hluz commented on July 23, 2024

Nicola, I understand and see the validity of your point about minimising payload size, and about the duplicated data inside the payload. For the etag though, as you mention, it would make sense to be in the payload (as well the HTTP header). In other words, forget about point 1 and keep point 2.

from eve.

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

What if this 'choerence mode' is disabled by default but you can switch it on with a global setting, something like a COHERENCE_MODE boolean?

from eve.

hluz avatar hluz commented on July 23, 2024

That would totally do it, of course ;-)

from eve.

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

Screw the COHERENCE_MODE we'll just throw the ETag in the payload instead. :)

from eve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.