Amazon Rekognition · API Governance Rules

Amazon Rekognition API Rules

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

18 Rules error 8 warn 8 info 2
View Rules File View on GitHub

Rule Categories

info 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 must be defined in 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[*]

Spectral Ruleset

Raw ↑
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 must be defined in components
    message: Security schemes should be defined in components/securitySchemes
    severity: warn
    given: $
    then:
      field: components.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