open-api icon indicating copy to clipboard operation
open-api copied to clipboard

Validator: Default to version from schema

Open silverwind opened this issue 5 years ago • 2 comments

OpenAPI/Swagger schemas can define their version in the schema, so the validator can use that in the absence of the version argument:

{"openapi": "3.0.1"}
{"swagger": "2.0"}

Also related, I think the current integer version argument should also accept string, e.g. the OpenAPI 3.1.0 will have to validate differently than 3.0.1 for example.

silverwind avatar Aug 25 '20 09:08 silverwind

@silverwind can you submit a pr for this?

jsdevel avatar Aug 25 '20 16:08 jsdevel

For the default value, possibly. It would coerce the version to the first digit of the string in the spec, if present. Long-term and once 3.1.0 is supported, the option format will have to change to string I guess.

silverwind avatar Aug 25 '20 16:08 silverwind