Amazon Supply Chain · API Governance Rules

Amazon Supply Chain API Rules

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

24 Rules error 11 warn 10 info 3
View Rules File View on GitHub

Rule Categories

get info no openapi operation path paths query 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[*]
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
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')]
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
servers-expected-domain
Server URLs should be on the amazonaws.com domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be camelCase (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be camelCase (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be camelCase (the dominant convention in this API).
$.components.schemas[*].properties

Spectral Ruleset

Raw ↑
# amazon-supply-chain — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on amazonaws.com
#   - path-params-casing: camel @ 68% (n=34)
#   - query-params-casing: camel @ 100% (n=14)
#   - operationid-casing: pascal @ 100% (n=24)
#   - schema-names-casing: pascal @ 100% (n=7)
#   - schema-properties-casing: camel @ 64% (n=39)
#   - security: global (root) — NOT emitting operation-security-required
#   - pagination params observed: ['maxResults', 'nextToken']
#   - merge: kept 18 existing, added 7 measured, upgraded 0
#   - added: servers-https-only, servers-expected-domain, path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, security-schemes-defined
extends:
  - spectral:oas
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 should be defined in components.
    severity: warn
    given: $.components
    then:
      field: 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
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-expected-domain:
    description: Server URLs should be on the amazonaws.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: amazonaws\.com
  path-params-casing:
    description: Path parameters should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: camel
  query-params-casing:
    description: Query parameters should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: camel
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be camelCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: camel