Tempo · API Governance Rules

Tempo API Rules

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

9 Rules error 2 warn 6 info 1
View Rules File View on GitHub

Rule Categories

tempo

Rules

info
tempo-no-auth-required
Tempo HTTP API is an internal service API without authentication by design
$.paths[*][get,post,put,delete].security
error
tempo-operation-id-required
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
tempo-operation-id-camel-case
OperationIds should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
warn
tempo-summary-title-case
Operation summaries must use Title Case
$.paths[*][get,post,put,patch,delete].summary
warn
tempo-operation-tags-required
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
tempo-operation-description-required
All operations must have a description
$.paths[*][get,post,put,patch,delete]
warn
tempo-traceid-pattern
traceID path parameters should enforce hex format
$.paths[*].parameters[?(@.name=='traceID')].schema
error
tempo-server-urls-required
API spec must define server URLs
$
warn
tempo-success-response-schema
Successful responses should include a schema
$.paths[*][get].responses.200.content.application/json

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:

  # Tempo API has no auth - all operations should be public (internal service)
  tempo-no-auth-required:
    description: Tempo HTTP API is an internal service API without authentication by design
    message: "Tempo API operations should not require authentication — it is an internal service"
    severity: info
    given: "$.paths[*][get,post,put,delete].security"
    then:
      function: falsy

  # Enforce operation IDs
  tempo-operation-id-required:
    description: All operations must have an operationId
    message: "Operation is missing operationId"
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  # Enforce camelCase operation IDs
  tempo-operation-id-camel-case:
    description: OperationIds should use camelCase
    message: "operationId '{{value}}' should use camelCase"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  # Enforce Title Case summaries
  tempo-summary-title-case:
    description: Operation summaries must use Title Case
    message: "Summary '{{value}}' should use Title Case"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]+$"

  # Enforce tags
  tempo-operation-tags-required:
    description: All operations must have at least one tag
    message: "Operation is missing tags"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  # Enforce descriptions
  tempo-operation-description-required:
    description: All operations must have a description
    message: "Operation is missing a description"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: description
      function: truthy

  # TraceID path parameters should have hex pattern validation
  tempo-traceid-pattern:
    description: traceID path parameters should enforce hex format
    message: "traceID parameter should have hex format pattern"
    severity: warn
    given: "$.paths[*].parameters[?(@.name=='traceID')].schema"
    then:
      field: pattern
      function: truthy

  # Server URLs required
  tempo-server-urls-required:
    description: API spec must define server URLs
    message: "API spec is missing server definitions"
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  # 200 responses must have schemas
  tempo-success-response-schema:
    description: Successful responses should include a schema
    message: "200 response is missing a schema"
    severity: warn
    given: "$.paths[*][get].responses.200.content.application/json"
    then:
      field: schema
      function: truthy