bravado icon indicating copy to clipboard operation
bravado copied to clipboard

Handle patch requirements differently

Open InAnimaTe opened this issue 9 years ago • 2 comments

If I have an available patch operation with an operationId of modifyBlock and a parameter that references my object definition where there are 3 required properties, herp, derp, and cake, whilst using Bravado, I'm not able to properly patch merely derp without getting a ValidationError: 'herp' is a required property (note that all 3 are set to required in my definition as they are needed for post and put operations)

I'm not exactly blaming Bravado here. But something needs to be done either in the Swagger spec or to properly deal with patch operations in clients, like Bravado. Without making another definition completely and leaving out the required fields, there is no way around this.

I'd really appreciate some input from the community here on how others handle this problem or what possibilities exist for resolving this.

InAnimaTe avatar Jan 13 '16 18:01 InAnimaTe

I think the best bet is to go with polymorphism and create a second model definition from the first. But i think bravado doesn't support polymorphism yet.

prat0318 avatar Jan 13 '16 19:01 prat0318

^yeah that's definitely a way to do it. Kinda waiting on https://github.com/Yelp/bravado-core/pull/63

InAnimaTe avatar Jan 13 '16 19:01 InAnimaTe