ibm-quantum · API Governance Rules

ibm-quantum API Rules

Spectral linting rules defining API design standards and conventions for ibm-quantum.

4 Rules error 2 warn 2
View Rules File View on GitHub

Rule Categories

ibm

Rules

error
ibm-quantum-path-prefix
All Qiskit Runtime REST endpoints are versioned under /v1.
$.paths
warn
ibm-quantum-snake-case-fields
IBM Quantum REST responses use snake_case property names.
$.components.schemas.*.properties.*~
error
ibm-quantum-bearer-required
All operations require IBM Cloud IAM bearer authentication.
$.paths.*[get,post,put,patch,delete]
warn
ibm-quantum-version-header
Operations should accept the IBM-API-Version header.
$.paths.*[get,post,put,patch,delete].parameters[?(@.in == 'header' && @.name == 'IBM-API-Version')]

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
documentationUrl: https://github.com/api-evangelist/ibm-quantum
overrides: []
functionsDir: ./functions
rules:
  # Operation discipline
  operation-operationId: error
  operation-operationId-unique: error
  operation-tag-defined: error
  operation-summary: error
  operation-description: warn
  operation-tags: error

  # IBM Quantum naming conventions
  ibm-quantum-path-prefix:
    description: All Qiskit Runtime REST endpoints are versioned under /v1.
    given: $.paths
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            "^/v1/.*$": true
          additionalProperties: false

  ibm-quantum-snake-case-fields:
    description: IBM Quantum REST responses use snake_case property names.
    given: $.components.schemas.*.properties.*~
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-z0-9_]*$"

  # Security scheme presence
  ibm-quantum-bearer-required:
    description: All operations require IBM Cloud IAM bearer authentication.
    given: $.paths.*[get,post,put,patch,delete]
    severity: error
    then:
      field: security
      function: truthy

  ibm-quantum-version-header:
    description: Operations should accept the IBM-API-Version header.
    given: $.paths.*[get,post,put,patch,delete].parameters[?(@.in == 'header' && @.name == 'IBM-API-Version')]
    severity: warn
    then:
      function: truthy

  # OpenAPI quality bar
  no-empty-servers: error
  contact-properties: warn
  info-license: warn
  oas3-api-servers: error
  oas3-server-not-example.com: error