Airbyte · API Governance Rules

Airbyte API Rules

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

28 Rules error 9 warn 12 info 7
View Rules File View on GitHub

Rule Categories

delete get info microcks no openapi operation parameter paths request response schema security servers

Rules

error
info-title-required
Info title must be defined.
$.info
warn
info-description-required
Info description must be defined and non-empty.
$.info
error
info-version-required
Info version must be defined.
$.info
error
openapi-version-3
OpenAPI version must be 3.x.
$
error
servers-defined
Servers array must be defined.
$
warn
servers-https
Server URLs should use HTTPS.
$.servers[*]
warn
paths-kebab-case
Path segments should use kebab-case.
$.paths[*]~
warn
paths-no-trailing-slash
Paths must not have trailing slashes.
$.paths[*]~
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-description-required
Every operation should have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-operationId-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationId-camelCase
operationId should use camelCase.
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
Every operation must have at least one tag.
$.paths[*][get,post,put,patch,delete]
info
operation-summary-starts-with-airbyte
Operation summaries should start with "Airbyte".
$.paths[*][get,post,put,patch,delete].summary
warn
parameter-description-required
All parameters must have a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
error
parameter-schema-required
All parameters must have a schema.
$.paths[*][get,post,put,patch,delete].parameters[*]
info
request-body-json-content
Request bodies should use application/json content type.
$.paths[*][post,put,patch].requestBody.content
error
response-success-required
Every operation must have at least one 2xx response.
$.paths[*][get,post,put,patch,delete].responses
warn
response-description-required
All responses must have a description.
$.paths[*][get,post,put,patch,delete].responses[*]
info
response-401-on-secured-ops
Secured operations should document 401 response.
$.paths[*][get,post,put,patch,delete].responses
info
schema-properties-snake-case
Schema property names should use snake_case.
$.components.schemas[*].properties[*]~
info
schema-description-required
Top-level schemas should have a description.
$.components.schemas[*]
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
info
security-bearer-format
Bearer security should use bearerFormat JWT or similar.
$.components.securitySchemes[*][?(@.scheme == 'bearer')]
error
get-no-request-body
GET operations should not have a request body.
$.paths[*].get
warn
delete-no-request-body
DELETE operations should not have a request body.
$.paths[*].delete
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description
info
microcks-operation-extension
Operations should include x-microcks-operation for mock compatibility.
$.paths[*][get,post,put,patch,delete]

Spectral Ruleset

Raw ↑
rules:
  # INFO / METADATA
  info-title-required:
    description: Info title must be defined.
    severity: error
    given: "$.info"
    then:
      field: title
      function: truthy

  info-description-required:
    description: Info description must be defined and non-empty.
    severity: warn
    given: "$.info"
    then:
      field: description
      function: truthy

  info-version-required:
    description: Info version must be defined.
    severity: error
    given: "$.info"
    then:
      field: version
      function: truthy

  # OPENAPI VERSION
  openapi-version-3:
    description: OpenAPI version must be 3.x.
    severity: error
    given: "$"
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: "^3\\."

  # SERVERS
  servers-defined:
    description: Servers array must be defined.
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  servers-https:
    description: Server URLs should use HTTPS.
    severity: warn
    given: "$.servers[*]"
    then:
      field: url
      function: pattern
      functionOptions:
        match: "^https://"

  # PATHS — NAMING CONVENTIONS
  paths-kebab-case:
    description: Path segments should use kebab-case.
    severity: warn
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}-]+)+$"

  paths-no-trailing-slash:
    description: Paths must not have trailing slashes.
    severity: warn
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        notMatch: "/$"

  # OPERATIONS
  operation-summary-required:
    description: Every operation must have a summary.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  operation-description-required:
    description: Every operation should have a description.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: description
      function: truthy

  operation-operationId-required:
    description: Every operation must have an operationId.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  operation-operationId-camelCase:
    description: operationId should use camelCase.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  operation-tags-required:
    description: Every operation must have at least one tag.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  operation-summary-starts-with-airbyte:
    description: Operation summaries should start with "Airbyte".
    severity: info
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^Airbyte "

  # PARAMETERS
  parameter-description-required:
    description: All parameters must have a description.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].parameters[*]"
    then:
      field: description
      function: truthy

  parameter-schema-required:
    description: All parameters must have a schema.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].parameters[*]"
    then:
      field: schema
      function: truthy

  # REQUEST BODIES
  request-body-json-content:
    description: Request bodies should use application/json content type.
    severity: info
    given: "$.paths[*][post,put,patch].requestBody.content"
    then:
      function: truthy

  # RESPONSES
  response-success-required:
    description: Every operation must have at least one 2xx response.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1

  response-description-required:
    description: All responses must have a description.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].responses[*]"
    then:
      field: description
      function: truthy

  response-401-on-secured-ops:
    description: Secured operations should document 401 response.
    severity: info
    given: "$.paths[*][get,post,put,patch,delete].responses"
    then:
      function: truthy

  # SCHEMAS — PROPERTY NAMING
  schema-properties-snake-case:
    description: Schema property names should use snake_case.
    severity: info
    given: "$.components.schemas[*].properties[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-z0-9_]*$"

  schema-description-required:
    description: Top-level schemas should have a description.
    severity: info
    given: "$.components.schemas[*]"
    then:
      field: description
      function: truthy

  # SECURITY
  security-schemes-defined:
    description: Security schemes should be defined in components.
    severity: warn
    given: "$.components"
    then:
      field: securitySchemes
      function: truthy

  security-bearer-format:
    description: Bearer security should use bearerFormat JWT or similar.
    severity: info
    given: "$.components.securitySchemes[*][?(@.scheme == 'bearer')]"
    then:
      field: bearerFormat
      function: truthy

  # HTTP METHOD CONVENTIONS
  get-no-request-body:
    description: GET operations should not have a request body.
    severity: error
    given: "$.paths[*].get"
    then:
      field: requestBody
      function: falsy

  delete-no-request-body:
    description: DELETE operations should not have a request body.
    severity: warn
    given: "$.paths[*].delete"
    then:
      field: requestBody
      function: falsy

  # GENERAL QUALITY
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: "$..description"
    then:
      function: truthy

  microcks-operation-extension:
    description: Operations should include x-microcks-operation for mock compatibility.
    severity: info
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: x-microcks-operation
      function: truthy