Open ColinEberhardt opened 2 years ago
If im not mistaken generate.js:49 await SwaggerParser.validate(cloneSchema(schema));
does this.
I tested by changing the Pet model in the petstore.json swagger schema.
object
-> objct
and it failed to validate schema.
I did the same with the type
-> tyrpe
and it failed to validate
I also tested the petsotre.json schema that i converted into yml and it also gave validation errors.
the petstore.json is OpenAPI v3.0.2
What I'm considering with this issue is that when an object has constraints associated with it, we generate a model object that enforces those constraints. Does that make sense?
Ok, yes that makes sense. @osouthwell-scottlogic had a little exploration into this and found that for CSharp it will be simple as you can add validation to model objects but TypeScript will be a little more time consuming as all supported validators will need to be written by hand.
As per https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#properties
OpenAPI supports a subset of JSON Schema rules for validating values.