Use Redocly CLI to validate OpenAPI definitions #1558
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I worked on upgrading the OpenAPI data (#1310), I found swagger-parser unreliable, mostly because this tool found errors that swagger-parser didn't report. There are also other benefits for using this:
check-swagger-sources.py
script. However to make it work we need to remove$ref
s inside examples, as it is not spec compliant.I found this tool with this list: openapi.tools. Of the tools that advertise support for OpenAPI 3.1, only two work with our definition files:
They both have similar features so we could use Spectral instead, but I found Redocly CLI visibly faster (although it's a matter of seconds in both cases).
Another advantage for some is that Redocly CLI integrates with VS CodeIt turns out Spectral too.The configuration file here deactivates the minimum number of rules to make our definitions pass validation. They can be re-enabled by fixing the errors reported in subsequent PRs.
Signed-off-by: Kévin Commaille [email protected]
Preview: https://pr1558--matrix-spec-previews.netlify.app