Amazon Supply Chain · API Governance Rules

Amazon Supply Chain API Rules

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

18 Rules error 11 warn 5 info 2
View Rules File View on GitHub

Rule Categories

get info no openapi operation paths response schema security servers tags

Rules

warn
info-title-prefix
API title must start with "Amazon" or "AWS"
$.info.title
error
info-description-required
Info must have description
$.info
error
info-version-required
Info must have version
$.info
error
openapi-version
Must use OpenAPI 3.x
$
error
servers-required
Servers must be defined
$
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,delete,patch]
warn
operation-summary-amazon-prefix
Summary must start with "Amazon" or "AWS"
$.paths[*][get,post,put,delete,patch].summary
error
operation-id-required
Every operation must have operationId
$.paths[*][get,post,put,delete,patch]
warn
operation-id-pascal-case
OperationId must use PascalCase
$.paths[*][get,post,put,delete,patch].operationId
warn
operation-tags-required
Operations must have tags
$.paths[*][get,post,put,delete,patch]
error
response-success-required
Operations must have 2xx response
$.paths[*][get,post,put,delete,patch].responses
error
response-description-required
Responses must have descriptions
$.paths[*][get,post,put,delete,patch].responses[*]
error
security-schemes-defined
Security schemes must be defined
$
error
get-no-request-body
GET must not have request body
$.paths[*].get
info
paths-kebab-case
Path segments should use kebab-case
$.paths
warn
tags-title-case
Tags should use Title Case
$.tags[*].name
error
no-empty-descriptions
Descriptions must not be empty
$..description
info
schema-description-on-objects
Object schemas should have descriptions
$.components.schemas[?(@.type == 'object')]

Spectral Ruleset

Raw ↑
rules:
  info-title-prefix:
    description: API title must start with "Amazon" or "AWS"
    severity: warn
    given: "$.info.title"
    then:
      function: pattern
      functionOptions:
        match: "^(Amazon|AWS) "
  info-description-required:
    description: Info must have description
    severity: error
    given: "$.info"
    then:
      field: description
      function: truthy
  info-version-required:
    description: Info must have version
    severity: error
    given: "$.info"
    then:
      field: version
      function: truthy
  openapi-version:
    description: Must use OpenAPI 3.x
    severity: error
    given: "$"
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: "^3\\."
  servers-required:
    description: Servers must be defined
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy
  operation-summary-required:
    description: Every operation must have a summary
    severity: error
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: summary
      function: truthy
  operation-summary-amazon-prefix:
    description: Summary must start with "Amazon" or "AWS"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].summary"
    then:
      function: pattern
      functionOptions:
        match: "^(Amazon|AWS) "
  operation-id-required:
    description: Every operation must have operationId
    severity: error
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: operationId
      function: truthy
  operation-id-pascal-case:
    description: OperationId must use PascalCase
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].operationId"
    then:
      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,delete,patch]"
    then:
      field: tags
      function: truthy
  response-success-required:
    description: Operations must have 2xx response
    severity: error
    given: "$.paths[*][get,post,put,delete,patch].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ["200"]
            - required: ["201"]
            - required: ["204"]
  response-description-required:
    description: Responses must have descriptions
    severity: error
    given: "$.paths[*][get,post,put,delete,patch].responses[*]"
    then:
      field: description
      function: truthy
  security-schemes-defined:
    description: Security schemes must be defined
    severity: error
    given: "$"
    then:
      field: "components.securitySchemes"
      function: truthy
  get-no-request-body:
    description: GET must not have request body
    severity: error
    given: "$.paths[*].get"
    then:
      field: requestBody
      function: falsy
  paths-kebab-case:
    description: Path segments should use kebab-case
    severity: info
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}-]+)+$"
  tags-title-case:
    description: Tags should use Title Case
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]+$"
  no-empty-descriptions:
    description: Descriptions must not be empty
    severity: error
    given: "$..description"
    then:
      function: pattern
      functionOptions:
        match: ".+"
  schema-description-on-objects:
    description: Object schemas should have descriptions
    severity: info
    given: "$.components.schemas[?(@.type == 'object')]"
    then:
      field: description
      function: truthy