Amazon RoboMaker · API Governance Rules

Amazon RoboMaker API Rules

Spectral linting rules defining API design standards and conventions for Amazon RoboMaker.

19 Rules error 8 warn 10 info 1
View Rules File View on GitHub

Rule Categories

delete get info openapi operation parameter response schema security server servers

Rules

error
info-title-required
API must have a title
$.info
warn
info-description-required
API must have a description
$.info
error
info-version-required
API must have a version
$.info
error
openapi-version-3
API must use OpenAPI 3.x
$
error
servers-defined
Servers must be defined
$
warn
server-https
Server URLs should use HTTPS
$.servers[*]
error
operation-summary-required
Operations must have a summary
$.paths[*][get,post,put,patch,delete,options,head]
warn
operation-description-required
Operations must have a description
$.paths[*][get,post,put,patch,delete,options,head]
error
operation-id-required
Operations must have an operationId
$.paths[*][get,post,put,patch,delete,options,head]
warn
operation-id-camel-case
OperationId should use camelCase
$.paths[*][get,post,put,patch,delete,options,head]
warn
operation-tags-required
Operations must have tags
$.paths[*][get,post,put,patch,delete,options,head]
warn
parameter-description-required
Parameters must have descriptions
$.paths[*][*].parameters[*]
error
response-success-required
Operations must have a success response
$.paths[*][get,post,put,patch,delete]
warn
response-description-required
Responses must have descriptions
$.paths[*][*].responses[*]
warn
schema-type-defined
Schema properties should have types
$.components.schemas[*].properties[*]
info
schema-description-required
Top-level schemas should have descriptions
$.components.schemas[*]
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
warn
delete-no-request-body
DELETE operations should not have a request body
$.paths[*].delete

Spectral Ruleset

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

  info-description-required:
    description: API must have a description
    severity: warn
    given: "$.info"
    then:
      field: description
      function: truthy

  info-version-required:
    description: API must have a version
    severity: error
    given: "$.info"
    then:
      field: version
      function: truthy

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

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

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

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

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

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

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

  operation-tags-required:
    description: Operations must have tags
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete,options,head]"
    then:
      field: tags
      function: truthy

  # PARAMETERS
  parameter-description-required:
    description: Parameters must have descriptions
    severity: warn
    given: "$.paths[*][*].parameters[*]"
    then:
      field: description
      function: truthy

  # RESPONSES
  response-success-required:
    description: Operations must have a success response
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: responses
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ['200']
            - required: ['201']
            - required: ['202']
            - required: ['204']

  response-description-required:
    description: Responses must have descriptions
    severity: warn
    given: "$.paths[*][*].responses[*]"
    then:
      field: description
      function: truthy

  # SCHEMAS
  schema-type-defined:
    description: Schema properties should have types
    severity: warn
    given: "$.components.schemas[*].properties[*]"
    then:
      field: type
      function: truthy

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

  # SECURITY
  security-schemes-defined:
    description: Security schemes should be defined
    severity: warn
    given: "$.components"
    then:
      field: securitySchemes
      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