Validate OpenAPI spec before generating
Description
It would be nice if a property could be passed in to have the OpenAPI spec validated before generation.
https://github.com/Redocly/redocly-cli offers an excellent cli for validating spec files.
Good suggestion @seriouslag. Do you use Redocly or run into issues where the cause is your spec?
I use Redocly. I was about to add the feature into openapi-react-query-codegen, but then figured it would be better in this repo. Wanted to get your opinion.
We have consumers who use incorrect spec files, get empty output, and are confused by the result. We get issues raised because the spec files are incorrect and then I ask them to validate the specs before raising issues.
openapi-ts nor openapi-react-query-codegen give any explanation if the specs are incorrect and they appear successful in generation.
I believe it would be better DX to add an option to validate the spec files.
We'd probably want a "valudate" config option. Users may not want to use it. Shouldn't be too difficult to add in.
We also support file or URL inputs. Redocly may not allow linting with remote file.
We also support file or URL inputs. Redocly may not allow linting with remote file.
If they don't support it, it might not be a bad option to dereference the input and write it to disk. We could then lint the de-referenced version. We could have a flag to preserve the dereferenced file if the user wants but delete it by default.
We probably should only be looking for structural issues. Things that will break the code generation and not worry about most other errors, an option to expose those to the CLI may be nice to add as well.
I agree with the issue around people asking for bug fixes when the problem is with their spec. @jordanshatford we'd need to check how much of a performance hit it would be to validate first, but I imagine it won't be a showstopper
But also to be clear, this isn't serious enough of an issue today to prioritise