Apache Airflow · API Governance Rules

Apache Airflow API Rules

Spectral linting rules defining API design standards and conventions for Apache Airflow.

33 Rules error 8 warn 16 info 9
View Rules File View on GitHub

Rule Categories

dag delete error get info microcks no openapi operation operationid parameter path paths query response schema security servers

Rules

error
info-title-required
Info title must be defined.
$.info
warn
info-description-required
Info description must be defined.
$.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 must be defined.
$
info
paths-api-v2-prefix
Stable API paths should start with /api/v2/.
$.paths[*]~
info
paths-kebab-case
Path segments should use snake_case or kebab-case.
$.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-tags-required
Every operation must have at least one tag.
$.paths[*][get,post,put,patch,delete]
info
operation-summary-starts-with-airflow
Operation summaries should start with "Airflow".
$.paths[*][get,post,put,patch,delete].summary
warn
parameter-description-required
All parameters should have a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
error
response-success-required
Every operation must have at least one success 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-documented
Operations should document 401 Unauthorized responses.
$.paths[*][get,post,put,patch,delete].responses
info
schema-description-recommended
Top-level schemas should have a description.
$.components.schemas[*]
info
schema-properties-snake-case
Schema property names should use snake_case.
$.components.schemas[*].properties[*]~
warn
security-schemes-defined
Security schemes should be defined.
$.components
error
get-no-request-body
GET operations should not have a request body.
$.paths[*].get
info
delete-returns-204
DELETE operations should return 204 No Content.
$.paths[*].delete.responses
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]
info
dag-resource-required
DAG endpoints are core to Airflow — they must be documented.
$.paths
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
operationid-casing
Operation IDs should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].operationId
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-security-required
Every operation should declare its security requirements.
$.paths[*][get,post,put,patch,delete]
warn
error-schema-defined
A shared error schema (HTTPValidationError) should be defined for error payloads.
$.components.schemas
warn
operation-documents-401
Operations should document a 401 response (documented on 96% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-403
Operations should document a 403 response (documented on 96% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
# airflow — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - path-params-casing: snake @ 100% (n=158)
#   - query-params-casing: snake @ 100% (n=324)
#   - operationid-casing: snake @ 100% (n=110)
#   - schema-names-casing: pascal @ 89% (n=140)
#   - schema-properties-casing: snake @ 100% (n=752)
#   - operation-security-required: 106/110 ops declare per-op security
#   - error-schema-defined: HTTPValidationError
#   - operation-documents-401: 96% adherence
#   - operation-documents-403: 96% adherence
#   - pagination params observed: ['cursor', 'limit', 'offset']
#   - merge: kept 24 existing, added 9 measured, upgraded 0
#   - added: path-params-casing, query-params-casing, operationid-casing, schema-names-casing, schema-properties-casing, operation-security-required, error-schema-defined, operation-documents-401, operation-documents-403
extends:
  - spectral:oas
rules:
  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.
    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-3:
    description: OpenAPI version must be 3.x.
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  servers-defined:
    description: Servers must be defined.
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  paths-api-v2-prefix:
    description: Stable API paths should start with /api/v2/.
    severity: info
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/api/v2/|/ui/)
  paths-kebab-case:
    description: Path segments should use snake_case or kebab-case.
    severity: info
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9_{}/-]+)+$
  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-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-airflow:
    description: Operation summaries should start with "Airflow".
    severity: info
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^Airflow '
  parameter-description-required:
    description: All parameters should have a description.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy
  response-success-required:
    description: Every operation must have at least one success response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: truthy
  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-documented:
    description: Operations should document 401 Unauthorized responses.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: truthy
  schema-description-recommended:
    description: Top-level schemas should have a description.
    severity: info
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  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_]*$
  security-schemes-defined:
    description: Security schemes should be defined.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  get-no-request-body:
    description: GET operations should not have a request body.
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  delete-returns-204:
    description: DELETE operations should return 204 No Content.
    severity: info
    given: $.paths[*].delete.responses
    then:
      function: truthy
  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
  dag-resource-required:
    description: DAG endpoints are core to Airflow — they must be documented.
    severity: info
    given: $.paths
    then:
      function: truthy
  path-params-casing:
    description: Path parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: snake
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  operationid-casing:
    description: Operation IDs should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  operation-security-required:
    description: Every operation should declare its security requirements.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: security
      function: truthy
  error-schema-defined:
    description: A shared error schema (HTTPValidationError) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: HTTPValidationError
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 96% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  operation-documents-403:
    description: Operations should document a 403 response (documented on 96% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '403'
      function: truthy