Amazon Rekognition · API Governance Rules

Amazon Rekognition API Rules

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

23 Rules error 8 warn 13 info 2
View Rules File View on GitHub

Rule Categories

error info no operation post response schema security servers tag

Rules

warn
info-title-prefix
Info title must start with Amazon Rekognition
$.info.title
error
info-description-required
Info must have a description
$.info
error
info-version-required
Info must have a version
$.info
error
servers-required
At least one server must be defined
$
error
servers-https
Server URLs must use HTTPS
$.servers[*].url
error
operation-summary-required
All operations must have a summary
$.paths[*][*]
warn
operation-summary-prefix
Operation summaries must start with Amazon Rekognition
$.paths[*][*].summary
error
operation-description-required
All operations must have a description
$.paths[*][*]
error
operation-operationid-required
All operations must have an operationId
$.paths[*][*]
warn
operation-operationid-camelcase
OperationIds must use camelCase
$.paths[*][*].operationId
warn
operation-tags-required
All operations must have at least one tag
$.paths[*][*]
warn
operation-security-required
All operations should specify security
$.paths[*][*]
error
response-success-required
Operations must have a 2xx success response
$.paths[*][*].responses
warn
response-400-recommended
Operations should have a 400 error response
$.paths[*][*].responses
warn
schema-description-required
Top-level schemas should have descriptions
$.components.schemas[*]
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
info
post-must-use-amz-json
POST operations should use AWS JSON content type
$.paths[*].post.requestBody.content
info
tag-descriptions-required
Global tags should have descriptions
$.tags[*]
warn
servers-expected-domain
Server URLs should be on the amazonaws.com domain.
$.servers[*].url
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
schema-properties-casing
Schema properties should be PascalCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (ErrorResponse) should be defined for error payloads.
$.components.schemas
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# amazon-rekognition — 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
#   - operationid-casing: camel @ 100% (n=15)
#   - schema-names-casing: pascal @ 100% (n=37)
#   - schema-properties-casing: pascal @ 98% (n=121)
#   - operation-security-required: 15/15 ops declare per-op security
#   - error-schema-defined: ErrorResponse
#   - operation-documents-400: 100% adherence
#   - merge: kept 18 existing, added 6 measured, upgraded 0
#   - added: servers-expected-domain, schema-names-casing, schema-properties-casing, security-schemes-defined, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-prefix:
    description: Info title must start with Amazon Rekognition
    message: Info title should start with "Amazon Rekognition"
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Amazon Rekognition
  info-description-required:
    description: Info must have a description
    message: Info object must have a description
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: Info must have a version
    message: API version is required
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  servers-required:
    description: At least one server must be defined
    message: Servers array must be defined and non-empty
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https:
    description: Server URLs must use HTTPS
    message: Server URL must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  operation-summary-required:
    description: All operations must have a summary
    message: Operation must have a summary
    severity: error
    given: $.paths[*][*]
    then:
      field: summary
      function: truthy
  operation-summary-prefix:
    description: Operation summaries must start with Amazon Rekognition
    message: Operation summary should start with "Amazon Rekognition"
    severity: warn
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: ^Amazon Rekognition
  operation-description-required:
    description: All operations must have a description
    message: Operation must have a description
    severity: error
    given: $.paths[*][*]
    then:
      field: description
      function: truthy
  operation-operationid-required:
    description: All operations must have an operationId
    message: Operation must have an operationId
    severity: error
    given: $.paths[*][*]
    then:
      field: operationId
      function: truthy
  operation-operationid-camelcase:
    description: OperationIds must use camelCase
    message: OperationId must use camelCase
    severity: warn
    given: $.paths[*][*].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  operation-tags-required:
    description: All operations must have at least one tag
    message: Operation must have at least one tag
    severity: warn
    given: $.paths[*][*]
    then:
      field: tags
      function: truthy
  operation-security-required:
    description: All operations should specify security
    message: Operation should define security requirements
    severity: warn
    given: $.paths[*][*]
    then:
      field: security
      function: truthy
  response-success-required:
    description: Operations must have a 2xx success response
    message: Operation must define at least one 2xx success response
    severity: error
    given: $.paths[*][*].responses
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
          - required:
            - '202'
          - required:
            - '204'
  response-400-recommended:
    description: Operations should have a 400 error response
    message: Operation should define a 400 Bad Request response
    severity: warn
    given: $.paths[*][*].responses
    then:
      field: '400'
      function: truthy
  schema-description-required:
    description: Top-level schemas should have descriptions
    message: Schema must have a description
    severity: warn
    given: $.components.schemas[*]
    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
  post-must-use-amz-json:
    description: POST operations should use AWS JSON content type
    message: POST operations should use application/x-amz-json-1.1 content type
    severity: info
    given: $.paths[*].post.requestBody.content
    then:
      function: schema
      functionOptions:
        schema:
          required:
          - application/x-amz-json-1.1
  tag-descriptions-required:
    description: Global tags should have descriptions
    message: Tag must have a description
    severity: info
    given: $.tags[*]
    then:
      field: description
      function: truthy
  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
  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 PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  error-schema-defined:
    description: A shared error schema (ErrorResponse) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: ErrorResponse
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy