Amazon Athena · API Governance Rules

Amazon Athena API Rules

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

19 Rules error 12 warn 7
View Rules File View on GitHub

Rule Categories

athena

Rules

error
athena-query-string-required
StartQueryExecution must require QueryString
$.components.schemas.StartQueryExecutionInput
warn
athena-operation-id-camel-case
All operationIds must be camelCase
$.paths[*][*].operationId
warn
athena-summary-prefix
All operation summaries must start with Amazon Athena
$.paths[*][*].summary
warn
athena-has-tags
All operations must have tags
$.paths[*][*]
warn
athena-server-url-fixed
Server URL must be fixed without variables
$.servers[*]
error
athena-response-200
All operations must have a 200 response
$.paths[*][*].responses
error
athena-request-body-required
POST operations must have a request body
$.paths[*].post
error
athena-query-execution-id-string
QueryExecutionId must be of type string
$.components.schemas[*].properties.QueryExecutionId
error
athena-named-query-id-string
NamedQueryId must be of type string
$.components.schemas[*].properties.NamedQueryId
error
athena-work-group-state-enum
WorkGroup State must use valid enum values
$.components.schemas.WorkGroup.properties.State
error
athena-data-catalog-type-enum
DataCatalog Type must use valid enum values
$.components.schemas.DataCatalog.properties.Type
error
athena-query-status-state-enum
QueryExecutionStatus State must use valid enum values
$.components.schemas.QueryExecutionStatus.properties.State
error
athena-tag-key-defined
Tag schema must define Key property
$.components.schemas.Tag.properties
error
athena-tag-value-defined
Tag schema must define Value property
$.components.schemas.Tag.properties
warn
athena-result-configuration-output-location
ResultConfiguration must have OutputLocation
$.components.schemas.ResultConfiguration.properties
warn
athena-engine-version-defined
EngineVersion schema must be defined
$.components.schemas
error
athena-column-info-name-defined
ColumnInfo must define Name property
$.components.schemas.ColumnInfo.properties
warn
athena-example-microcks-default
All examples must have x-microcks-default set to true
$.paths[*][*].requestBody.content[*].examples.default
error
athena-security-sigv4
API must use sigv4 security scheme
$.security[*]

Spectral Ruleset

Raw ↑
rules:
  athena-query-string-required:
    description: StartQueryExecution must require QueryString
    message: StartQueryExecutionInput must have QueryString as required
    severity: error
    given: "$.components.schemas.StartQueryExecutionInput"
    then:
      field: required
      function: truthy

  athena-operation-id-camel-case:
    description: All operationIds must be camelCase
    message: "{{property}} must be camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  athena-summary-prefix:
    description: All operation summaries must start with Amazon Athena
    message: Summary must start with Amazon Athena
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^Amazon Athena"

  athena-has-tags:
    description: All operations must have tags
    message: Operation must have at least one tag
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  athena-server-url-fixed:
    description: Server URL must be fixed without variables
    message: Server URL must not use variables
    severity: warn
    given: "$.servers[*]"
    then:
      field: variables
      function: falsy

  athena-response-200:
    description: All operations must have a 200 response
    message: Operation must define a 200 response
    severity: error
    given: "$.paths[*][*].responses"
    then:
      field: "200"
      function: truthy

  athena-request-body-required:
    description: POST operations must have a request body
    message: POST operation must have a requestBody
    severity: error
    given: "$.paths[*].post"
    then:
      field: requestBody
      function: truthy

  athena-query-execution-id-string:
    description: QueryExecutionId must be of type string
    message: QueryExecutionId must be a string
    severity: error
    given: "$.components.schemas[*].properties.QueryExecutionId"
    then:
      field: type
      function: enumeration
      functionOptions:
        values:
          - string

  athena-named-query-id-string:
    description: NamedQueryId must be of type string
    message: NamedQueryId must be a string
    severity: error
    given: "$.components.schemas[*].properties.NamedQueryId"
    then:
      field: type
      function: enumeration
      functionOptions:
        values:
          - string

  athena-work-group-state-enum:
    description: WorkGroup State must use valid enum values
    message: WorkGroup State must be ENABLED or DISABLED
    severity: error
    given: "$.components.schemas.WorkGroup.properties.State"
    then:
      field: enum
      function: truthy

  athena-data-catalog-type-enum:
    description: DataCatalog Type must use valid enum values
    message: DataCatalog Type must be LAMBDA, GLUE, or HIVE
    severity: error
    given: "$.components.schemas.DataCatalog.properties.Type"
    then:
      field: enum
      function: truthy

  athena-query-status-state-enum:
    description: QueryExecutionStatus State must use valid enum values
    message: State must be QUEUED, RUNNING, SUCCEEDED, FAILED, or CANCELLED
    severity: error
    given: "$.components.schemas.QueryExecutionStatus.properties.State"
    then:
      field: enum
      function: truthy

  athena-tag-key-defined:
    description: Tag schema must define Key property
    message: Tag must have a Key property
    severity: error
    given: "$.components.schemas.Tag.properties"
    then:
      field: Key
      function: truthy

  athena-tag-value-defined:
    description: Tag schema must define Value property
    message: Tag must have a Value property
    severity: error
    given: "$.components.schemas.Tag.properties"
    then:
      field: Value
      function: truthy

  athena-result-configuration-output-location:
    description: ResultConfiguration must have OutputLocation
    message: ResultConfiguration must define OutputLocation
    severity: warn
    given: "$.components.schemas.ResultConfiguration.properties"
    then:
      field: OutputLocation
      function: truthy

  athena-engine-version-defined:
    description: EngineVersion schema must be defined
    message: EngineVersion must be defined in components
    severity: warn
    given: "$.components.schemas"
    then:
      field: EngineVersion
      function: truthy

  athena-column-info-name-defined:
    description: ColumnInfo must define Name property
    message: ColumnInfo must have Name
    severity: error
    given: "$.components.schemas.ColumnInfo.properties"
    then:
      field: Name
      function: truthy

  athena-example-microcks-default:
    description: All examples must have x-microcks-default set to true
    message: Example must have x-microcks-default true
    severity: warn
    given: "$.paths[*][*].requestBody.content[*].examples.default"
    then:
      field: x-microcks-default
      function: truthy

  athena-security-sigv4:
    description: API must use sigv4 security scheme
    message: Security must include sigv4
    severity: error
    given: "$.security[*]"
    then:
      field: sigv4
      function: defined