schema validation for examples in swagger
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Labels:
-
Swagger Editor
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, your good idea for improving those examples are not validated against their schema or sub-schema some type errors remove.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 😉
