Skip to content

Conversation

@rpocklin
Copy link
Collaborator

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.yaml to the files validated in validate-all.sh

The ruleset extends the default using xero-spectral.yaml to make allowances for our current state of Open API specs, and can be improved upon in future PRs.

Future Improvements

  • Ensure all OpenAPI spec files are named consistently (currently xero_ and xero-) and possibly moving them into their own dedicated folder.
  • Use a glob pattern to validate all OpenAPI specs rather than listing them explicitly.
  • Run spectral only once vs. currently run once per file.
  • Consider more specific policies to improve build / release workflows and supported / unsupported data and attribute types or combinations.

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):

./validator/scripts/validate-all.sh

Or via the local Github Workflow runner act (requires Node.js +npm install + docker):

act --workflows ".github/workflows/spectral-lint.yml" --secret-file "" --var-file "" --input-file "" --eventpath ""

Screenshots (if appropriate):

Screenshot 2025-08-20 at 11 36 28 am

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@github-actions
Copy link

PETOSS-811

@github-actions
Copy link

Thanks for raising an issue, a ticket has been created to track your request

@lkaszick lkaszick merged commit a7963dd into XeroAPI:master Aug 25, 2025
2 checks passed
@github-actions
Copy link

🎉 This PR is included in version 9.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 9.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@xero-public-bot
Copy link

🎉 This PR is included in version 9.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants