Can we add an flag to disable throwing on invalid types, or any other cases InvalidInputError? I'm volunteering to do it, just checking its something you'd want. I'm also not sure what to call it. "loose mode", "compat mode", etc.
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. :)
The text was updated successfully, but these errors were encountered:
Can you see a case where someone would want to throw InvalidInputError but not InvalidTypeError or vice versa? I was just thinking if one flag is enough.
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 strictMode and setting it to true by default. If there comes a need to do something other than throwing in case of invalid type etc., we could just introduce a breaking change and bump up the version.