DataHub · API Governance Rules

DataHub API Rules

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

5 Rules warn 4 info 1
View Rules File View on GitHub

Rule Categories

no operation payload security server

Rules

warn
server-security-defined
Servers should declare their security requirements.
$.servers[*]
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
info
payload-property-casing
Message payload properties should be camelCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-id-casing
Operation IDs should be camelCase (the dominant convention in this API).
$.channels[*][publish,subscribe].operationId
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# datahub — AsyncAPI Spectral ruleset (strengthened)
# Plain Spectral. Rules measured from this provider's own AsyncAPI event
# conventions by strengthen_asyncapi.py, then self-validated against the spec.
#
# Provenance:
#   - server-security-defined: 1/1 servers
#   - security-schemes: ['saslPlain']
#   - payload-property-casing: camel @ 60% (n=38)
#   - operation-id-casing: camel @ 100% (n=3, v2)
extends:
  - spectral:asyncapi
rules:
  server-security-defined:
    description: Servers should declare their security requirements.
    severity: warn
    given: $.servers[*]
    then:
      field: security
      function: truthy
  security-schemes-defined:
    description: Security schemes should be defined in components.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  payload-property-casing:
    description: Message payload properties should be camelCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: camel
  operation-id-casing:
    description: Operation IDs should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.channels[*][publish,subscribe].operationId
    then:
      function: casing
      functionOptions:
        type: camel
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy