At a glance#
The guidelines are a Spectral ruleset, @api360/spectral-ruleset. It extends the standard spectral:oas rules and adds the rules named on the other pages of this section.
| Profile | For | Differences |
|---|---|---|
vendor (provider) | A product API a provider publishes | The major version is in the path; creating POSTs document Idempotency-Key; path variables are checked as a hint |
platform | The 13 domain specifications of the platform | No version segment; no idempotency rules; path variables are not checked |
A run exits with 0 when every finding is below the failing severity (warn by default) or covered by the allow-list, and with 1 otherwise.
Run it#
npm install @api360/spectral-ruleset npx api360-spectral --profile vendor openapi/product.yaml npx api360-spectral --profile platform --exclude index.json --report-dir spectral-report openapi/domains
The command prints the findings per spec and per rule and writes summary.md, summary.json and findings.json to the report directory. --fail-severity error lets warnings through; --no-allowlist shows everything.
The package comes from the GitLab package registry of the api360-ai group. Point the @api360 scope at it in .npmrc:
@api360:registry=https://gitlab.com/api/v4/projects/84641482/packages/npm/In a pipeline#
A repository that holds OpenAPI files includes the shared job, which carries the ruleset inside it and needs no registry:
include: - project: 'api360-ai/pipeline-orchestrator' ref: main file: 'ci-templates/spectral-lint.gitlab-ci.yml' variables: SPECTRAL_PROFILE: vendor SPECTRAL_PATHS: openapi
The job runs in merge request pipelines, fails on a finding the allow-list does not cover, and keeps the report as an artifact.
The allow-list#
A finding a specification cannot fix yet goes into a dated allow-list, never into a blanket ignore. Each entry names the rule, the reason, the change that closes it, a review date, and a count per specification. One finding above the count fails the run, and an entry past its review date fails it as well, so "clean" means every remaining finding is written down and owned.
Checked by#
| Rule family | Rules |
|---|---|
| Naming | api360-property-snake-case, api360-query-param-snake-case, api360-path-param-snake-case, api360-enum-value-case, api360-path-kebab-case |
| Errors | api360-error-envelope-schema, api360-error-responses-declared |
| Pagination | api360-pagination-params, api360-pagination-response |
| Idempotency | api360-idempotency-key-header, api360-idempotency-responses |
| Versioning | api360-version-info, api360-version-in-path, api360-platform-unversioned-paths |
| Deprecation | api360-deprecation-headers |
| Security | api360-operation-security, api360-no-apikey-in-query |
See also#
- API design guidelines: the rules as prose.
- For providers: publishing a product.