Cloverly · API Governance Rules

Cloverly API Rules

Spectral linting rules defining API design standards and conventions for Cloverly.

4 Rules warn 3
View Rules File View on GitHub

Rule Categories

cloverly

Rules

warn
cloverly-versioned-path
All Cloverly API paths must be prefixed with /2019-03-beta/.
$.paths[*]~
warn
cloverly-bearer-auth
Cloverly authenticates via Bearer tokens issued from the dashboard.
$.components.securitySchemes[*]
warn
cloverly-title-case-summaries
Operation summaries should use Title Case and start with the provider name.
$.paths.*.*.summary
hint
cloverly-co2e-grams-units
Emissions response fields should be in grams with explicit naming.
$.components.schemas..properties[?(@property === "co2")]

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]
rules:
  cloverly-versioned-path:
    description: All Cloverly API paths must be prefixed with /2019-03-beta/.
    message: 'Path {{property}} must start with /2019-03-beta/ (Cloverly''s versioning convention).'
    severity: warn
    given: '$.paths[*]~'
    then:
      function: pattern
      functionOptions:
        match: '^/2019-03-beta/'
  cloverly-bearer-auth:
    description: Cloverly authenticates via Bearer tokens issued from the dashboard.
    message: Operations must declare bearer auth.
    severity: warn
    given: '$.components.securitySchemes[*]'
    then:
      field: scheme
      function: pattern
      functionOptions:
        match: '^bearer$'
  cloverly-title-case-summaries:
    description: Operation summaries should use Title Case and start with the provider name.
    message: 'Summary "{{value}}" should be Title Case and lead with "Cloverly".'
    severity: warn
    given: '$.paths.*.*.summary'
    then:
      function: pattern
      functionOptions:
        match: '^Cloverly [A-Z][A-Za-z]*( [A-Z][A-Za-z]*)*$'
  cloverly-co2e-grams-units:
    description: Emissions response fields should be in grams with explicit naming.
    message: Use total_co2e_in_grams (or *_in_kg) — Cloverly never uses ambiguous "co2" field names.
    severity: hint
    given: '$.components.schemas..properties[?(@property === "co2")]'
    then:
      function: falsy