Apache CloudStack · API Governance Rules

Apache CloudStack API Rules

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

12 Rules error 3 warn 8 info 1
View Rules File View on GitHub

Rule Categories

cloudstack

Rules

error
cloudstack-api-info-title
API info must have a title
$.info
warn
cloudstack-api-info-description
API info must have a description
$.info
error
cloudstack-api-info-version
API info must have a version
$.info
error
cloudstack-api-operation-id
All operations must have an operationId
$.paths[*][get,put,post,delete,patch]
warn
cloudstack-api-operation-summary
All operations must have a summary
$.paths[*][get,put,post,delete,patch]
warn
cloudstack-api-operation-tags
All operations must have at least one tag
$.paths[*][get,put,post,delete,patch]
warn
cloudstack-api-response-200
GET operations should have a 200 response
$.paths[*][get]
warn
cloudstack-api-schema-title
All component schemas must have a title
$.components.schemas[*]
warn
cloudstack-api-schema-description
All component schemas must have a description
$.components.schemas[*]
warn
cloudstack-api-summary-prefix
Operation summaries should start with Apache CloudStack
$.paths[*][get,put,post,delete,patch].summary
warn
cloudstack-api-apikey-security
All operations should use apiKeyAuth security
$.paths[*][get,put,post,delete,patch]
info
cloudstack-api-microcks-operation
All operations should have x-microcks-operation extension
$.paths[*][get,put,post,delete,patch]

Spectral Ruleset

Raw ↑
rules:
  cloudstack-api-info-title:
    description: API info must have a title
    message: API info.title is required
    severity: error
    given: $.info
    then:
      field: title
      function: truthy

  cloudstack-api-info-description:
    description: API info must have a description
    message: API info.description is required
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy

  cloudstack-api-info-version:
    description: API info must have a version
    message: API info.version is required
    severity: error
    given: $.info
    then:
      field: version
      function: truthy

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

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

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

  cloudstack-api-response-200:
    description: GET operations should have a 200 response
    message: GET operations should define a 200 response
    severity: warn
    given: $.paths[*][get]
    then:
      field: responses.200
      function: truthy

  cloudstack-api-schema-title:
    description: All component schemas must have a title
    message: Schema must have a title
    severity: warn
    given: $.components.schemas[*]
    then:
      field: title
      function: truthy

  cloudstack-api-schema-description:
    description: All component schemas must have a description
    message: Schema must have a description
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy

  cloudstack-api-summary-prefix:
    description: Operation summaries should start with Apache CloudStack
    message: Operation summary should begin with "Apache CloudStack"
    severity: warn
    given: $.paths[*][get,put,post,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: ^Apache CloudStack

  cloudstack-api-apikey-security:
    description: All operations should use apiKeyAuth security
    message: Operation should declare apiKeyAuth security
    severity: warn
    given: $.paths[*][get,put,post,delete,patch]
    then:
      field: security
      function: truthy

  cloudstack-api-microcks-operation:
    description: All operations should have x-microcks-operation extension
    message: Operation should include x-microcks-operation for mock support
    severity: info
    given: $.paths[*][get,put,post,delete,patch]
    then:
      field: x-microcks-operation
      function: truthy