Amazon QLDB · API Governance Rules

Amazon QLDB API Rules

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

19 Rules error 12 warn 6 info 1
View Rules File View on GitHub

Rule Categories

get info no openapi operation paths response schema security servers

Rules

error
info-title-required
API must have a title
$.info
error
info-description-required
API must have a description
$.info
error
info-version-required
API version must be defined
$.info
error
openapi-version-3
API should use OpenAPI 3.x
$.openapi
error
servers-defined
Servers must be defined
$
warn
servers-https
Server URLs must use HTTPS
$.servers[*].url
info
paths-restful-design
Paths should use RESTful resource naming
$.paths
error
operation-summary-required
All operations must have a summary
$.paths[*][get,post,put,delete,patch]
warn
operation-summary-amazon-qldb-prefix
Summaries should start with Amazon QLDB
$.paths[*][get,post,put,delete,patch].summary
error
operation-description-required
All operations must have a description
$.paths[*][get,post,put,delete,patch]
error
operation-id-required
All operations must have an operationId
$.paths[*][get,post,put,delete,patch]
warn
operation-tags-required
All operations must have tags
$.paths[*][get,post,put,delete,patch]
error
response-success-required
All operations must have a success response
$.paths[*][get,post,put,delete,patch]
error
response-description-required
All responses must have descriptions
$.paths[*][*].responses[*]
warn
schema-type-defined
Schemas should define a type
$.components.schemas[*]
error
security-schemes-defined
Security schemes must be defined
$.components
warn
security-global-defined
Global security must be defined
$
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
warn
no-empty-descriptions
Descriptions must not be empty
$..description

Spectral Ruleset

Raw ↑
rules:

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

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

  openapi-version-3:
    description: API should use OpenAPI 3.x
    severity: error
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: "^3\\."

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

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

  paths-restful-design:
    description: Paths should use RESTful resource naming
    message: Paths should use kebab-case resource names
    severity: info
    given: $.paths
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}_/-]+)+$"

  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-amazon-qldb-prefix:
    description: Summaries should start with Amazon QLDB
    message: Operation summary should start with 'Amazon QLDB'
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: "^Amazon QLDB"

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

  operation-id-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 tags
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: truthy

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

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

  schema-type-defined:
    description: Schemas should define a type
    severity: warn
    given: $.components.schemas[*]
    then:
      field: type
      function: truthy

  security-schemes-defined:
    description: Security schemes must be defined
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy

  security-global-defined:
    description: Global security must be defined
    severity: warn
    given: $
    then:
      field: security
      function: truthy

  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy

  no-empty-descriptions:
    description: Descriptions must not be empty
    severity: warn
    given: $..description
    then:
      function: truthy