Parse validation information in Schema#225
Conversation
|
Interesting. Validation is certainly useful - we have been using kin-openapi to validate input based on the spec. The schema object is getting unwieldy. It would be nice to simply refer to the inner spec to fetch the validations. I'm thinking of a V2 version of this library, which greatly simplifies much of this complexity. V1 was a learning experience. Do you have any examples of how this all ties together? It's hard to see from just the change to Schema. |
|
This allowed us to have a simple template that uses |
|
So, the idea here is to use the oapi spec to generate validation annotations so that you can use to validate struct conformance agains the spec using ozzo-validation? I was thinking of going into a different direction with this. Already, using the validation middleware, we will ensure on the server side that client requests are correct, but what is missing is the following. 1 - We need a swagger aware function to bind a request body to a destination schema, which handles default values. This will make sure that your schema is conformant |
|
Right now we're returning from the server the exact struct generated for the client (from #231), combined with OAPI spec annotation (and some of our own |
|
Superceded by #365 (we use fields directly from the |
Validationfield inSchemacontaining OpenAPI validation fields (min, max, length, pattern etc.)We used this information in our fork to generate auto-validation templates using ozzo-validation. I wonder if having such functionality built-in would be desirable to upstream?
This change is