Comments (11)
Right. The "ID style" is more transitional, it isn't ideal. We'd like to support a transitional path from "Rails REST" to a better way. As you mention yourself. I think that 'calling it out' would be useful.
from json-api.
👍 to @steveklabnik. I look at URL-style as the fully HTTP, REST approach, with discoverability, etc. and ID-style as transitional for backwards compatibility with those server and client frameworks that currently focus inordinately on IDs.
from json-api.
i.e. ID-style intentionally the full benefits of HTTP and REST design for compatibility
from json-api.
@lukfugl Yep. Since the URI-templates format can be bolted onto the "ID Style", I think we could suggest transitioning first to "ID-Style" from "Rails 'REST' Style" and then to URI-templates as this would maintain the most backwards compatibility while introducing the most hypermedia benefits.
from json-api.
And documenting this process will be useful to help drive adoption.
from json-api.
A little bit of an aside here, but I see people favouring ?ids=1,2,3
. Is there a reason this format is favoured over ?id=1&id=2&id=3
? I know at least some languages allow returning multiple values for each key, but I don't remember if all of them do. I couldn't find anything about it in the RFC.
from json-api.
@paddyforan It's an unnecessarily verbose format with limited support. What's the upside?
from json-api.
@reinh I wasn't sure if support was limited or not, to be honest. Which is why I asked. It seems like a more semantic way to accomplish things to me, so I thought it may be part of a spec, but I couldn't find any reference to it. I'm all for going with the more supported option, I just am surprised that comma-delimited lists are the more supported option.
from json-api.
@paddyforan Unfortunately, it's not very simple. The spec is completely silent on the issue so there is no defined behavior. Some servers will return an array while others will return the first or last value. Even for servers that return an array, the ordering is not always guaranteed. There's even an exploit based on this behavior called HPP that this OWASP talk digs into.
At least with foos=1,2,3
we have a chance to define the behavior explicitly for all compliant servers without running headlong into incompatible legacy behaviors or security concerns.
from json-api.
That all seems pretty reasonable to me. I wish servers had standardised around returning an array (it feels more semantic/proper for some reason, I really can't explain why), but it seems like rolling our own in this case may actually be the right thing to do.
Thanks for the explanation!
from json-api.
I think this discussion has come to a close. I'll be doing more to signal the difference between the two styles soon.
from json-api.
Related Issues (20)
- Is there any way to include not related models into a model for JsonApiFramework 2.8.0? HOT 2
- Provide JSON Schema for JSON:API 1.1 HOT 2
- Provide an updates list/blog HOT 9
- 1.1 seems to contain a breaking change - 'lid' now required for resource creation? HOT 2
- How is 'lid' actually used? The 1.1 spec says nothing about this HOT 13
- Allow custom resource links HOT 13
- Why the square bracket syntax for query params? HOT 7
- consider support for implementation-specific members HOT 2
- JSON-LD integration example HOT 1
- Clarify intent of links member HOT 1
- How does one document a JSON:API HOT 4
- 1.1 spec disallows e.g. filter[author.name] HOT 4
- Inclusion of related resources for heterogeneous collections
- PrimaryResourceType not to be null at this point HOT 1
- Create/update relationships having attributes? HOT 3
- ember-data link on implementations page is broken HOT 2
- Bulk delete as either extention or implementation HOT 4
- Extend Spec To Allow Creation of Multiple Resources in One API Call HOT 1
- Profiles should be allowed to define query parameters HOT 5
- JSONRenderer does not extract includes from PolymorphicModelSerializer properly HOT 1
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 json-api.