Apache Dubbo · API Governance Rules

Apache Dubbo API Rules

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

15 Rules error 5 warn 9 info 1
View Rules File View on GitHub

Rule Categories

info no operation parameter paths response schema

Rules

error
info-title-required
Info title must be defined
$.info
warn
info-description-required
Info description must be present
$.info
error
info-version-required
API version must be specified
$.info
error
operation-summary-required
All operations must have a summary
$.paths[*][get,post,put,delete,patch]
warn
operation-summary-apache-dubbo-prefix
Operation summaries should start with Apache Dubbo
$.paths[*][get,post,put,delete,patch].summary
warn
operation-description-required
All operations must have a description
$.paths[*][get,post,put,delete,patch]
error
operation-operationId-required
All operations must have an operationId
$.paths[*][get,post,put,delete,patch]
warn
operation-tags-required
All operations must have at least one tag
$.paths[*][get,post,put,delete,patch]
warn
paths-kebab-case
Path segments should use kebab-case
$.paths
warn
paths-no-trailing-slash
Paths must not have trailing slashes
$.paths
warn
parameter-description-required
All parameters must have descriptions
$.paths[*][get,post,put,delete,patch].parameters[*]
error
response-success-required
Operations must define at least one 2xx response
$.paths[*][get,post,put,delete,patch].responses
warn
response-description-required
All responses must have descriptions
$.paths[*][get,post,put,delete,patch].responses[*]
info
schema-property-description
Schema properties should have descriptions
$.definitions[*].properties[*]
warn
no-empty-descriptions
Descriptions must not be empty strings
$..description

Spectral Ruleset

Raw ↑
# Apache Dubbo Admin API Spectral Ruleset
# Enforces conventions observed across the Dubbo Admin API specification

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 present
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy

  info-version-required:
    description: API version must be specified
    severity: error
    given: $.info
    then:
      field: version
      function: truthy

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

  operation-summary-apache-dubbo-prefix:
    description: Operation summaries should start with Apache Dubbo
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: "^Apache Dubbo"

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

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

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

  # PATHS
  paths-kebab-case:
    description: Path segments should use kebab-case
    severity: warn
    given: $.paths
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}_-]+)+$"

  paths-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: warn
    given: $.paths
    then:
      field: "@key"
      function: pattern
      functionOptions:
        notMatch: "/$"

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

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

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

  # SCHEMAS
  schema-property-description:
    description: Schema properties should have descriptions
    severity: info
    given: $.definitions[*].properties[*]
    then:
      field: description
      function: truthy

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