Introduce spectral OpenAPI spec linting #742
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.
This PR is to introduce OpenAPI specification validation for all OpenAPI Spec files (
xero*.yaml)Description
Using the open source tool Spectral to validate OpenAPI Specification files to well known standards (with minimal customisations).
This change does not alter any Open API Specifications, however there is an issue raised here which would require a minimal type change to the response code only for one API spec. We could then add
xero-finance.yamlto the files validated invalidate-all.shThe ruleset extends the default using
xero-spectral.yamlto make allowances for our current state of Open API specs, and can be improved upon in future PRs.Future Improvements
xero_andxero-) and possibly moving them into their own dedicated folder.spectralonly once vs. currently run once per file.Release Notes
This PR aims to add a level of consistency into our OpenAPI specifications, minimally, with passing rules to enable improvements to this over time and to ensure our APIs remain consistent for any consumers of these specifications.
This workflow can be run manually (no-install script - only requires Node.js):
Or via the local Github Workflow runner
act(requires Node.js +npm install+ docker):Screenshots (if appropriate):
Types of Changes