Akamai API Security · API Governance Rules

Akamai API Security API Rules

Spectral linting rules defining API design standards and conventions for Akamai API Security.

28 Rules error 12 warn 15 info 1
View Rules File View on GitHub

Rule Categories

delete get info no openapi operation parameter path paths query response schema security servers

Rules

warn
info-title-format
$.info.title
error
info-description-required
$.info
error
info-version-required
$.info
error
openapi-version-3
$
error
servers-defined
$
warn
servers-https
$.servers[*].url
warn
paths-kebab-case
$.paths[*]~
error
paths-no-trailing-slash
$.paths[*]~
error
operation-summary-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-summary-akamai-prefix
$.paths[*][get,post,put,patch,delete,head,options].summary
warn
operation-description-required
$.paths[*][get,post,put,patch,delete,head,options]
error
operation-id-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-id-camel-case
$.paths[*][get,post,put,patch,delete,head,options].operationId
error
operation-tags-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
parameter-description-required
$.paths[*][get,post,put,patch,delete][*].parameters[*]
error
operation-success-response
$.paths[*][get,post,put,patch,delete]
error
response-description-required
$.paths[*][*].responses[*]
warn
schema-type-defined
$.components.schemas[*].properties[*]
warn
schema-description-required
$.components.schemas[*]
warn
security-schemes-defined
$.components
error
get-no-request-body
$.paths[*].get
warn
delete-no-request-body
$.paths[*].delete
error
no-empty-descriptions
$..description
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 kebab-case (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
warn
operation-documents-404
Operations should document a 404 response (documented on 90% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
# akamai-api-security — 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)
#   - path-params-casing: camel @ 99% (n=521)
#   - query-params-casing: camel @ 94% (n=238)
#   - operationid-casing: kebab @ 100% (n=213)
#   - schema-names-casing: kebab @ 94% (n=71)
#   - schema-properties-casing: camel @ 63% (n=304)
#   - operation-documents-404: 90% adherence
#   - pagination params observed: ['page', 'pageSize']
#   - merge: kept 23 existing, added 5 measured, upgraded 0
#   - added: path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, operation-documents-404
extends:
  - spectral:oas
rules:
  info-title-format:
    message: API title should start with 'Akamai'
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Akamai
  info-description-required:
    message: API info must have a description
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    message: API info must have a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  openapi-version-3:
    message: Must use OpenAPI 3.x
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  servers-defined:
    message: Servers must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https:
    message: Server URLs should use HTTPS
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-kebab-case:
    message: Path segments should use kebab-case
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(\/([a-z0-9][a-z0-9\-]*|\{[a-zA-Z][a-zA-Z0-9_]*\}))*$
  paths-no-trailing-slash:
    message: Paths must not have trailing slashes
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: \/$
  operation-summary-required:
    message: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: summary
      function: truthy
  operation-summary-akamai-prefix:
    message: Operation summaries should start with 'Akamai'
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].summary
    then:
      function: pattern
      functionOptions:
        match: ^Akamai
  operation-description-required:
    message: Every operation must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: description
      function: truthy
  operation-id-required:
    message: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: operationId
      function: truthy
  operation-id-camel-case:
    message: operationId should use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  operation-tags-required:
    message: Every operation must have at least one tag
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: tags
      function: truthy
  parameter-description-required:
    message: All parameters must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete][*].parameters[*]
    then:
      field: description
      function: truthy
  operation-success-response:
    message: Operations must have at least one 2xx response
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: responses
      function: truthy
  response-description-required:
    message: All responses must have a description
    severity: error
    given: $.paths[*][*].responses[*]
    then:
      field: description
      function: truthy
  schema-type-defined:
    message: Schema properties should have a type defined
    severity: warn
    given: $.components.schemas[*].properties[*]
    then:
      field: type
      function: truthy
  schema-description-required:
    message: Top-level schemas should have a description
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  security-schemes-defined:
    message: Security schemes should be defined
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  get-no-request-body:
    message: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  delete-no-request-body:
    message: DELETE operations should not have a request body
    severity: warn
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy
  no-empty-descriptions:
    message: Descriptions must not be empty
    severity: error
    given: $..description
    then:
      function: truthy
  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 kebab-case (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: kebab
  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: pattern
      functionOptions:
        match: ^[a-z][A-Za-z0-9]*$
  operation-documents-404:
    description: Operations should document a 404 response (documented on 90% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '404'
      function: truthy