# 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