D-Wave · API Governance Rules

D-Wave API Rules

Spectral linting rules defining API design standards and conventions for D-Wave.

6 Rules warn 6
View Rules File View on GitHub

Rule Categories

dwave

Rules

warn
dwave-info-contact
D-Wave API specs must include a contact pointing to docs.dwavequantum.com.
$.info
warn
dwave-server-sapi
Production SAPI servers must be under cloud.dwavesys.com or api.dwavesys.com.
$.servers[*].url
warn
dwave-security-token
Endpoints must declare the X-Auth-Token SAPI scheme or LeapOAuth.
$.components.securitySchemes
warn
dwave-operation-id-camelcase
operationId should be camelCase.
$.paths[*][*].operationId
warn
dwave-summary-title-case
Operation summary should be Title Case.
$.paths[*][*].summary
warn
dwave-problem-type-enum
Problem type fields must use the canonical six-value enum.
$..*[?(@property === 'type')]

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, recommended]]
rules:
  dwave-info-contact:
    description: D-Wave API specs must include a contact pointing to docs.dwavequantum.com.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  dwave-server-sapi:
    description: Production SAPI servers must be under cloud.dwavesys.com or api.dwavesys.com.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: '^https://(([a-z0-9-]+\.)?cloud|api)\.dwavesys\.com/'
  dwave-security-token:
    description: Endpoints must declare the X-Auth-Token SAPI scheme or LeapOAuth.
    severity: warn
    given: $.components.securitySchemes
    then:
      function: truthy
  dwave-operation-id-camelcase:
    description: operationId should be camelCase.
    severity: warn
    given: $.paths[*][*].operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'
  dwave-summary-title-case:
    description: Operation summary should be Title Case.
    severity: warn
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][^a-z].*'
  dwave-problem-type-enum:
    description: Problem type fields must use the canonical six-value enum.
    severity: warn
    given: "$..*[?(@property === 'type')]"
    then:
      function: truthy