Google Quantum AI · API Governance Rules

Google Quantum AI API Rules

Spectral linting rules defining API design standards and conventions for Google Quantum AI.

9 Rules error 4 warn 4 info 1
View Rules File View on GitHub

Rule Categories

google

Rules

error
google-quantum-ai-info-contact
Google Quantum AI specs must declare a contact (cirq-maintainers).
$.info
error
google-quantum-ai-info-license
Google Quantum AI specs must declare a license.
$.info
error
google-quantum-ai-server-quantum-googleapis
Servers must use the canonical quantum.googleapis.com host.
$.servers[*].url
warn
google-quantum-ai-version-prefix
Quantum Engine paths must be prefixed with the API version (v1alpha1).
$.paths.*~
warn
google-quantum-ai-operation-id-pascal-case
Operation IDs follow Google's PascalCase convention (e.g., CreateQuantumProgram).
$.paths.*.*.operationId
warn
google-quantum-ai-summary-title-case
Operation summaries should be in Title Case.
$.paths.*.*.summary
warn
google-quantum-ai-tag-defined
Every operation must be tagged with one of the Quantum Engine domain tags.
$.paths.*.*.tags[*]
error
google-quantum-ai-oauth-required
All operations should require Google Cloud OAuth 2.0.
$.security
info
google-quantum-ai-resource-name-pattern
Path parameters named `name` should describe a Quantum Engine resource hierarchy.
$.paths..parameters[?(@.name == 'name')]

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
formats:
  - oas3
rules:
  google-quantum-ai-info-contact:
    description: Google Quantum AI specs must declare a contact (cirq-maintainers).
    given: $.info
    severity: error
    then:
      field: contact
      function: truthy
  google-quantum-ai-info-license:
    description: Google Quantum AI specs must declare a license.
    given: $.info
    severity: error
    then:
      field: license
      function: truthy
  google-quantum-ai-server-quantum-googleapis:
    description: Servers must use the canonical quantum.googleapis.com host.
    given: $.servers[*].url
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^https://quantum\\.googleapis\\.com"
  google-quantum-ai-version-prefix:
    description: Quantum Engine paths must be prefixed with the API version (v1alpha1).
    given: $.paths.*~
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^/v1alpha1(/|$)"
  google-quantum-ai-operation-id-pascal-case:
    description: Operation IDs follow Google's PascalCase convention (e.g., CreateQuantumProgram).
    given: $.paths.*.*.operationId
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9]+$"
  google-quantum-ai-summary-title-case:
    description: Operation summaries should be in Title Case.
    given: $.paths.*.*.summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-zA-Z0-9]*)(\\s+[A-Z][a-zA-Z0-9]*)*$"
  google-quantum-ai-tag-defined:
    description: Every operation must be tagged with one of the Quantum Engine domain tags.
    given: $.paths.*.*.tags[*]
    severity: warn
    then:
      function: enumeration
      functionOptions:
        values:
          - Programs
          - Jobs
          - Processors
          - Calibrations
          - Reservations
          - Results
  google-quantum-ai-oauth-required:
    description: All operations should require Google Cloud OAuth 2.0.
    given: $.security
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1
  google-quantum-ai-resource-name-pattern:
    description: Path parameters named `name` should describe a Quantum Engine resource hierarchy.
    given: $.paths..parameters[?(@.name == 'name')]
    severity: info
    then:
      field: description
      function: truthy