Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
"loose mode" to avoid erring on invalid type/parameter #33
Can we add an flag to disable throwing on invalid types, or any other cases
Throwing on invalid types was introduced in v2.0.0, and it was a great feature to add to help people avoid writing invalid OpenAPI.
Working at Stoplight we deal with all sorts of specs, and sometimes folks have invalid OpenAPI which contains all sorts of JSON Schema-only stuff.
We try to guide people towards creating correct OpenAPI and JSON Schema with tools like Spectral providing general validation and specific guidance (no oneOf in OpenAPI v2, etc.) but having hard and early errors like this make it tough to use the tooling.
We need to convert OpenAPI to JSON Schema in various parts, so having it do the best conversion it can but just keep on trucking if it spots a problem would be really useful for us.
LMK what you think it should be called and I'll get it done. :)
This sounds like a valid addition.
Can you see a case where someone would want to throw
Also, there might be a use case for doing something else in case of an error rather than just ignoring it. This would cause a mess if we add just one boolean flag now.
For now, the simplest solution would probably be to add one flag
What do you think? :)