TensorDock · API Governance Rules

TensorDock API Rules

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

8 Rules error 3 warn 5
View Rules File View on GitHub

Rule Categories

tensordock

Rules

warn
tensordock-operation-summary-title-case
TensorDock operation summaries should use Title Case.
$.paths[*][get,post,put,delete,patch].summary
error
tensordock-operation-id-camel-case
TensorDock operationIds must use lowerCamelCase.
$.paths[*][get,post,put,delete,patch].operationId
error
tensordock-tags-present
Every operation should have at least one tag.
$.paths[*][get,post,put,delete,patch]
warn
tensordock-paths-lower-kebab
TensorDock paths use lowercase segments and kebab-case for compound names.
$.paths.~
warn
tensordock-api-key-pair-security
Marketplace v0 endpoints must reference the ApiKeyPair security scheme.
$.paths[/api/v0/*].*
warn
tensordock-bearer-security-v2
v2 endpoints must reference the BearerAuth security scheme.
$.paths[/api/v2/*].*
error
tensordock-success-response
Every operation must define a 2xx response.
$.paths[*][get,post,put,delete,patch].responses
warn
tensordock-info-contact
TensorDock specs should set a contact email.
$.info.contact

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
rules:
  tensordock-operation-summary-title-case:
    description: TensorDock operation summaries should use Title Case.
    message: '{{property}} summary should be Title Case.'
    given: '$.paths[*][get,post,put,delete,patch].summary'
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][A-Za-z0-9]*( [A-Z0-9][A-Za-z0-9()/-]*)*$'
  tensordock-operation-id-camel-case:
    description: TensorDock operationIds must use lowerCamelCase.
    message: '{{property}} must be camelCase (e.g., listInstances, createInstance).'
    given: '$.paths[*][get,post,put,delete,patch].operationId'
    severity: error
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]*$'
  tensordock-tags-present:
    description: Every operation should have at least one tag.
    given: '$.paths[*][get,post,put,delete,patch]'
    severity: error
    then:
      field: tags
      function: truthy
  tensordock-paths-lower-kebab:
    description: TensorDock paths use lowercase segments and kebab-case for compound names.
    message: 'Path segment {{value}} should be lowercase or {curly-braced} parameter.'
    given: '$.paths.~'
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^(/[a-z0-9_-]+|/\{[a-zA-Z_]+\})+$'
  tensordock-api-key-pair-security:
    description: Marketplace v0 endpoints must reference the ApiKeyPair security scheme.
    given: '$.paths[/api/v0/*].*'
    severity: warn
    then:
      field: security
      function: truthy
  tensordock-bearer-security-v2:
    description: v2 endpoints must reference the BearerAuth security scheme.
    given: '$.paths[/api/v2/*].*'
    severity: warn
    then:
      field: security
      function: truthy
  tensordock-success-response:
    description: Every operation must define a 2xx response.
    given: '$.paths[*][get,post,put,delete,patch].responses'
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            '^2\d\d$':
              type: object
  tensordock-info-contact:
    description: TensorDock specs should set a contact email.
    given: '$.info.contact'
    severity: warn
    then:
      field: email
      function: truthy