Open esoni88 opened 4 years ago
Are you looking for generated code which includes validation in models? We do this in some of our generators. We would need to know which language/framework you're targeting to know if it's implemented in the relevant generator.
@jimschubert from my point of view the question is more "should openapi generator include validation in generated coder or just provide mapping"? We use typescript-fetch for mapping and use ajv for validation. It's a little bit cumbersome, because there are some differences between them and sometimes we must implement some transformations to satisfy both. For example typescript-fetch doesn't supports nullable
very well and ajv doesn't supports oneOf
very well.
It would be great to have one tool. Should generated code include validation?
Nowadays, Is there a way to implement some sort of response validation against generated models?
There are various validation libs that you can pass a schema and payload to to validate. My observations are that sometimes libs spot different issues from eachother, the error messages are cryptic, but deal breaker for me was that the validators don't seem to include the option of detection of payload fields that are not in the oas. So I apply some opensource validation then apply my own "undeclared field" checker
Is your feature request related to a problem? Please describe.
I need a tool that validate the response of an api if it is compliant respect OpenApi specification.
Describe the solution you'd like
Openapi generator support the validator generation ?