flask-restx icon indicating copy to clipboard operation
flask-restx copied to clipboard

Using PATCH requests for updating resources

Open onlinejudge95 opened this issue 5 years ago • 5 comments

Ask a question I want to define PATCH as the HTTP verb for updating my resource, where I only want to update the resources partly, is there a way I can do it with validation support for those fields since I don't know beforehand what model is expected as any attribute can be changed(obviously removing the id and others)

onlinejudge95 avatar May 12 '20 20:05 onlinejudge95

I have the same question. Is there any way to do partial validation. I don't want to validate the presence of the fields, but that those fields present comply with the constraints set.

carlosvega avatar Dec 15 '20 14:12 carlosvega

So the validation should happen but "required" should be always set to false for validation of patch requests.

This would still allow, that the identifier which is needed to distinguish which object should be patched is missing, but this should be solved in a follow-up issue.

The current workaround is to use: @namespace.expect(MyModel,validate=False) before the def patch

maurerle avatar Apr 23 '21 20:04 maurerle

@maurerle any upcoming fix for the same, count me in if you need help.

onlinejudge95 avatar Apr 25 '21 05:04 onlinejudge95

Very interested as well.

carlosvega avatar May 19 '21 12:05 carlosvega

+1 here

ReznikovRoman avatar May 13 '22 12:05 ReznikovRoman