@coveo/api-standards
v0.0.3
Published
Coveo’s standard OpenAPI ruleset is enforced using [Spectral CLI](https://docs.stoplight.io/docs/spectral/674b27b261c3c-overview). This ruleset is made available for other tools at Coveo, ensuring that API owners can lint their OpenAPI specifications.
Keywords
Readme
OpenAPI Specifications
Coveo’s standard OpenAPI ruleset is enforced using Spectral CLI. This ruleset is made available for other tools at Coveo, ensuring that API owners can lint their OpenAPI specifications.
Consuming those rules
Install from npm
From an npm project, install the rules as a standard npm package.
npm i @coveo/api-standards @stoplight/spectral-cliThen create a local spectral.yaml file with only this configuration:
extends: "@coveo/api-standards"Adding New Rules
To add a new rule meant to be statically enforced at Coveo, follow this process:
Add the rule
Add a new rule intools/spectral-ruleset/spectral.yaml. Follow the Spectral CLI documentation to learn how to define a new rule.Add test cases
- Add a new test case file that verifies that the new rule correctly catches an OpenAPI violation
- Add a new entry in
valid.openapi.jsonto verify that the new rule does not incorrectly flag a valid OpenAPI specification.
Test the new rule
- Install
pnpm - At the root of the repo, run
pnpm install - Then run
pnpm run test
- Install
