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

Validate only on POST/PUT

Open sputnikus opened this issue 11 years ago • 8 comments

Allows to use HEAD, OPTIONS on view or add GET method to it.

sputnikus avatar Apr 24 '14 12:04 sputnikus

Also have to consider the PATCH verb. It might make sense to make this configurable as well.

mattupstate avatar Apr 24 '14 13:04 mattupstate

I've added configuration variable (with ('POST', 'PUT', 'PATCH') default) and edited README.

sputnikus avatar Apr 24 '14 13:04 sputnikus

Validating PATCH this way is very difficult, because JSON Schema doesn't play very well with partial validation (well, in fact, "partial validation" is almost a nonsense). Not speaking of RFC6902.

honzajavorek avatar Apr 24 '14 14:04 honzajavorek

@honzajavorek So you are saying we should ditch PATCH from defaults and leave it to something like https://github.com/stefankoegl/python-json-patch?

sputnikus avatar Apr 24 '14 15:04 sputnikus

I don't really see the argument yet. It all depends on how the server expects a PATCH request to look and could be implemented in all sorts of ways. It could still possibly be validated by a jsonschema.

mattupstate avatar Apr 24 '14 16:04 mattupstate

Sure, so I leave as it is. Any other change for merging?

sputnikus avatar Apr 25 '14 09:04 sputnikus

@sputnikus looks good for now. I'm going to try and put aside some time to review my projects next week. At which point I will review again and potentially merge.

Thanks for your contribution!

mattupstate avatar Apr 25 '14 14:04 mattupstate

Sounds good, thank you for pointing my mistakes right away.

sputnikus avatar Apr 25 '14 15:04 sputnikus