joipolloi / json-validation-bundle

Symfony framework bundle providing an annotation for validating JSON passed with a request against a schema
MIT License
5 stars 5 forks source link

API can accept more than one format of Request body #4

Closed jasonbstanding closed 5 years ago

jasonbstanding commented 5 years ago

Hi there,

Our API endpoint can accept multiple formats of JSON request body (via JSON Schema / anyOf). Is there a way of instructing this validator (using @ValidateJson Annotations) to test an incoming body against multiple schemas & only trip if none of them are satisfied?

Thanks!

jasonbstanding commented 5 years ago

We got around the issue by bringing the validator in to the class and testing the body against multiple schemas - but that means bringing the validation inside the controller rather than "bolting it on to the front with an annotation". Hey ho.