Skip to content

Require 'id' is included in PATCH request #245

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

Merged
merged 3 commits into from
May 31, 2016

Conversation

tpilara
Copy link
Contributor

@tpilara tpilara commented May 31, 2016

According to the JSON API spec regarding the updating of resources:

The PATCH request MUST include a single resource object as primary data. The resource object MUST contain type and id members.

Currently the package will accept PATCH requests made that omit the id for the resource object.

This pull request fixes that and adds a test that verifies a 400 error is correctly thrown if a PATCH request is made without the id.

@scottfisk
Copy link
Contributor

scottfisk commented May 31, 2016

@tpilara Looks like your test failures are due to a misconfigured tox file, it was not your code. The specific failure was due to: https://github.com/django-json-api/django-rest-framework-json-api/blob/develop/tox.ini#L11. A django alpha 1.10 build dropped on PyPI and that got downloaded instead of 1.9.

I will PR a quick fix for that.

EDIT: Here

@tpilara
Copy link
Contributor Author

tpilara commented May 31, 2016

@scottfisk Thanks for the quick fix! I've got one more PR that I'd like to make (which will also fail when it gets run due to the same issue). I'm going to open that now, so after this gets merged in do you think you would be able to re-run the checks on my PRs from TravisCI?

If not I can always close and re-open them, just let me know. Thanks!

@jerel
Copy link
Member

jerel commented May 31, 2016

@tpilara I just merged the tox fix so you can now pull from our develop branch and push to your PR branches

@tpilara
Copy link
Contributor Author

tpilara commented May 31, 2016

@jerel Thanks for merging that PR in so quickly. I've merged that into my branch so tests should pass now.

@scottfisk
Copy link
Contributor

scottfisk commented May 31, 2016

this lgtm 👍, thanks @tpilara. @jerel Do we want the merge commit in there or a rebase?

@jerel
Copy link
Member

jerel commented May 31, 2016

@scottfisk I'm 👍 also, go ahead and merge it (doing a squash during merge is fine)

@scottfisk scottfisk merged commit d3eac6d into django-json-api:develop May 31, 2016
@tpilara tpilara deleted the require-id-on-patch branch June 1, 2016 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants