Tinybird · API Governance Rules

Tinybird API Rules

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

12 Rules error 6 warn 4
View Rules File View on GitHub

Rule Categories

tinybird

Rules

error
tinybird-operation-ids-required
All operations must have operationId values
$.paths[*][get,post,put,delete,patch]
error
tinybird-operation-summaries-required
All operations must have a summary
$.paths[*][get,post,put,delete,patch]
warn
tinybird-operation-tags-required
All operations must have at least one tag
$.paths[*][get,post,put,delete,patch]
error
tinybird-versioned-paths
All paths must begin with /v0/ to indicate API versioning
$.paths
hint
tinybird-no-trailing-slash
Paths should not have trailing slashes (except root collection paths)
$.paths
error
tinybird-bearer-auth-required
APIs must define bearer token security scheme
$.components.securitySchemes.bearerAuth
error
tinybird-response-200-defined
All GET operations must define a 200 response
$.paths[*].get
warn
tinybird-error-responses-defined
Operations should define 401 unauthorized responses
$.paths[*][post,put,delete,patch]
hint
tinybird-schemas-have-descriptions
Schema objects should have descriptions
$.components.schemas[*]
warn
tinybird-kebab-case-operation-ids
Operation IDs must use camelCase (Tinybird convention)
$.paths[*][get,post,put,delete,patch].operationId
warn
tinybird-info-contact-defined
API info must include contact information
$.info
error
tinybird-servers-defined
API must define server URLs
$

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:

  tinybird-operation-ids-required:
    description: All operations must have operationId values
    message: Operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: operationId
      function: defined

  tinybird-operation-summaries-required:
    description: All operations must have a summary
    message: Operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: summary
      function: defined

  tinybird-operation-tags-required:
    description: All operations must have at least one tag
    message: Operation must have at least one tag for grouping
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: defined

  tinybird-versioned-paths:
    description: All paths must begin with /v0/ to indicate API versioning
    message: Path {{value}} must begin with /v0/
    severity: error
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: "^/v0/"

  tinybird-no-trailing-slash:
    description: Paths should not have trailing slashes (except root collection paths)
    message: Path should not end with a trailing slash unless it is a collection path
    severity: hint
    given: $.paths
    then:
      function: pattern
      functionOptions:
        notMatch: ".[^/]/$"

  tinybird-bearer-auth-required:
    description: APIs must define bearer token security scheme
    message: Security scheme must include bearerAuth of type bearer
    severity: error
    given: $.components.securitySchemes.bearerAuth
    then:
      function: defined

  tinybird-response-200-defined:
    description: All GET operations must define a 200 response
    message: GET operation must have a 200 response defined
    severity: error
    given: $.paths[*].get
    then:
      field: responses.200
      function: defined

  tinybird-error-responses-defined:
    description: Operations should define 401 unauthorized responses
    message: Operation should include 401 response for unauthorized access
    severity: warn
    given: $.paths[*][post,put,delete,patch]
    then:
      field: responses.401
      function: defined

  tinybird-schemas-have-descriptions:
    description: Schema objects should have descriptions
    message: Schema property should include a description
    severity: hint
    given: $.components.schemas[*]
    then:
      field: description
      function: defined

  tinybird-kebab-case-operation-ids:
    description: Operation IDs must use camelCase (Tinybird convention)
    message: OperationId {{value}} must use camelCase
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].operationId
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  tinybird-info-contact-defined:
    description: API info must include contact information
    message: API info.contact must be defined
    severity: warn
    given: $.info
    then:
      field: contact
      function: defined

  tinybird-servers-defined:
    description: API must define server URLs
    message: At least one server must be defined
    severity: error
    given: $
    then:
      field: servers
      function: defined