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

PUT behaves like PATCH #28

Open
MichaelKetchel opened this issue Aug 2, 2023 · 2 comments
Open

PUT behaves like PATCH #28

MichaelKetchel opened this issue Aug 2, 2023 · 2 comments

Comments

@MichaelKetchel
Copy link

Issuing an update to a record via PUT behaves like PATCH, updating only the sent properties instead of completely replacing the record as would be expected. This mostly manifests when a nullable field was not originally null, but is desired to be nulled, and a PUT with new property values is sent without a null for that property.

Potentially consider a way to make PUT behave as expected, or indicate that PUT behaves like PATCH

@MichaelKetchel
Copy link
Author

it may make sense to have the OPTIONS return just PATCH for the "update" member method, and PUT as a "replace" method if supported?

@gregschmit
Copy link
Owner

Since Rails routes PUT and PATCH to the update action, I don't think I want to stray from that convention as it may be unintuitive for our users.

However, I think this could be resolved with an optional (and disabled by default) option (maybe put_replace) to have the default update action detect if the request method is PUT and either set the unspecified columns to nil (or their default value?). IIRC, Django REST Framework sets fields that are not passed to None for update action, but not partial_update action

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

No branches or pull requests

2 participants