Didomi · API Governance Rules

Didomi API Rules

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

10 Rules error 4 warn 5 info 1
View Rules File View on GitHub

Rule Categories

didomi

Rules

warn
didomi-info-title-prefix
API titles SHOULD start with "Didomi" to make the provider explicit.
$.info.title
error
didomi-info-description-required
API descriptions MUST be present.
$.info
error
didomi-servers-https
Server URLs MUST use HTTPS — Didomi redirects HTTP with a 301.
$.servers[*].url
warn
didomi-server-v1-prefix
Server URLs SHOULD include the /v1 versioned base path.
$.servers[*].url
warn
didomi-paths-kebab-case
Path segments SHOULD be kebab-case (consents/events, widgets/notices, sso-connections).
$.paths[*]~
error
didomi-operation-summary
Every operation MUST have a summary.
$.paths[*][*]
error
didomi-operation-tags
Every operation MUST be tagged with at least one of the Didomi resource group tags (consents/*, widgets/*, metadata/*, taxonomies, domains, secrets, keys, etc.).
$.paths[*][*]
warn
didomi-bearer-security
The API uses bearer JWT authentication — operations SHOULD declare bearer security except for /sessions endpoints that exchange API key + secret.
$.paths[?(@property != '/sessions' && @property != '/sessions/{id}')][*]
warn
didomi-error-responses
Operations SHOULD document 401 (missing/expired token), 429 (rate limit exceeded), and a default 4xx envelope.
$.paths[*][*].responses
info
didomi-pagination-shape
List operations SHOULD support cursor / offset pagination via standard query parameters.
$.paths[*].get.parameters

Spectral Ruleset

Raw ↑
extends:
- spectral:oas
documentationUrl: https://developers.didomi.io/api-and-platform/introduction
rules:
  didomi-info-title-prefix:
    description: API titles SHOULD start with "Didomi" to make the provider explicit.
    given: $.info.title
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^Didomi"
  didomi-info-description-required:
    description: API descriptions MUST be present.
    given: $.info
    severity: error
    then:
      field: description
      function: truthy
  didomi-servers-https:
    description: Server URLs MUST use HTTPS — Didomi redirects HTTP with a 301.
    given: $.servers[*].url
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^https://"
  didomi-server-v1-prefix:
    description: Server URLs SHOULD include the /v1 versioned base path.
    given: $.servers[*].url
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "/v1$"
  didomi-paths-kebab-case:
    description: Path segments SHOULD be kebab-case (consents/events, widgets/notices, sso-connections).
    given: $.paths[*]~
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^/[A-Za-z0-9/_{}\\-]+$"
  didomi-operation-summary:
    description: Every operation MUST have a summary.
    given: $.paths[*][*]
    severity: error
    then:
      field: summary
      function: truthy
  didomi-operation-tags:
    description: Every operation MUST be tagged with at least one of the Didomi resource group tags (consents/*, widgets/*, metadata/*, taxonomies, domains, secrets, keys, etc.).
    given: $.paths[*][*]
    severity: error
    then:
      field: tags
      function: truthy
  didomi-bearer-security:
    description: The API uses bearer JWT authentication — operations SHOULD declare bearer security except for /sessions endpoints that exchange API key + secret.
    given: $.paths[?(@property != '/sessions' && @property != '/sessions/{id}')][*]
    severity: warn
    then:
      field: security
      function: truthy
  didomi-error-responses:
    description: Operations SHOULD document 401 (missing/expired token), 429 (rate limit exceeded), and a default 4xx envelope.
    given: $.paths[*][*].responses
    severity: warn
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
          - required: ["401"]
          - required: ["default"]
  didomi-pagination-shape:
    description: List operations SHOULD support cursor / offset pagination via standard query parameters.
    given: $.paths[*].get.parameters
    severity: info
    then:
      function: schema
      functionOptions:
        schema:
          type: array