Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response status code to PATCH /staged with a bad JSON body #40

Open
garethsb opened this issue Sep 12, 2018 · 4 comments
Open

Response status code to PATCH /staged with a bad JSON body #40

garethsb opened this issue Sep 12, 2018 · 4 comments
Milestone

Comments

@garethsb
Copy link
Contributor

https://github.com/AMWA-TV/nmos-device-connection-management/blob/v1.0.x/APIs/ConnectionAPI.raml#L247-L250

The RAML seems to imply a JSON parsing error should result in a 500 response. But bad JSON is surely a client error and ought to be a 4xx code, just as schema or constraints violations are. IS-04 Registration API uses a 400 code for this.

500 ought to be reserved for intelligible requests that cannot be acted on.

@garethsb
Copy link
Contributor Author

garethsb commented Sep 12, 2018

Hmm, I've just re-read this. The RAML is talking about parsing of the transport file that may be embedded in the JSON... I still think a 4xx code is a better response ("I'm up and running but I don't understand what you said") than a 500 Internal Server Error in this case. 400 Bad Request ("I could not understand the request due to invalid syntax") probably.

@simonrankine
Copy link
Contributor

Hi Gareth,

I think this is a reasonable argument, but I'm a bit worried that this moves away a from a typo change to a more normative change, which we can't really do without the major version bump. Unless you feel this is a critical issue I'm tempted to put it as something that should be rolled into any future v2 update, and just leave it as a quirk of the spec for now.

Thoughts?

Regards,

Simon

@garethsb
Copy link
Contributor Author

OK... I think...
How do we track quirks? :-)

@simonrankine
Copy link
Contributor

Hi Gareth,

I'm putting "enhancement" tags on stuff in here that we should look at for future versions, so we can review it at that time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants