GithubHelp home page GithubHelp logo

Comments (11)

steveklabnik avatar steveklabnik commented on May 22, 2024

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.

lukfugl avatar lukfugl commented on May 22, 2024

👍 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.

lukfugl avatar lukfugl commented on May 22, 2024

i.e. ID-style intentionally the full benefits of HTTP and REST design for compatibility

from json-api.

reinh avatar reinh commented on May 22, 2024

@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.

steveklabnik avatar steveklabnik commented on May 22, 2024

And documenting this process will be useful to help drive adoption.

from json-api.

paddycarver avatar paddycarver commented on May 22, 2024

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.

reinh avatar reinh commented on May 22, 2024

@paddyforan It's an unnecessarily verbose format with limited support. What's the upside?

from json-api.

paddycarver avatar paddycarver commented on May 22, 2024

@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.

reinh avatar reinh commented on May 22, 2024

@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.

paddycarver avatar paddycarver commented on May 22, 2024

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.

steveklabnik avatar steveklabnik commented on May 22, 2024

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)

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.