Ask a Question

schema validation for examples in swagger

ghenrard
New Contributor

schema validation for examples in swagger

Hello, 

With OAS 3.0 it's now possible to add several examples to requests and responses, to clarify the main use cases and how they would look like.

However, I noticed in the Swagger Editor (old or new), those examples are not validated against their schema or sub-schema.

May I suggest to add this as an improvement ?

 

This could avoid some typo errors while creating the examples based on the generic one.

3 REPLIES 3
ponelat
Staff

Hi @ghenrard ,

 

Yeah, a valid use-case for sure. I'm not sure if it's required by the spec, so we'd have to introduce it as a warning. It would fall under the parser/validator, which is https://github.com/swagger-api/apidom

Mason234
Occasional Visitor

Yes, your good idea for improving those examples are not validated against their schema or sub-schema some type errors remove.

itunes for pc

Indeed, warning when an example is not valid is good enough. Even better if it says where (line number, etc.) it's not valid, like it's usually done in the editor 😉

cancel
Showing results for 
Search instead for 
Did you mean: