regal-entertainment-group · API Governance Rules

regal-entertainment-group API Rules

Spectral linting rules defining API design standards and conventions for regal-entertainment-group.

8 Rules error 2 warn 6
View Rules File View on GitHub

Rule Categories

regal

Rules

warn
regal-operation-ids-camel-case
Operation IDs must use camelCase
$.paths[*][*].operationId
warn
regal-tags-title-case
All tags must use Title Case
$.tags[*].name
warn
regal-paths-kebab-case
Path segments must use kebab-case
$.paths
warn
regal-v1-prefix
All paths must be prefixed with /v1/
$.paths
error
regal-requires-api-key-security
All operations must require the ApiKeyAuth security scheme
$.paths[*][*]
error
regal-operations-have-summaries
All operations must have a summary
$.paths[*][*]
warn
regal-response-200-has-schema
Successful GET responses must define a schema
$.paths[*].get.responses.200.content[*]
warn
regal-error-schema-defined
Error responses must reference the Error schema
$.paths[*][*].responses[?(@property >= '400')].content[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  regal-operation-ids-camel-case:
    description: Operation IDs must use camelCase
    message: "{{property}} must be camelCase (e.g., listMovies, getTheatre)"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  regal-tags-title-case:
    description: All tags must use Title Case
    message: "Tag '{{value}}' must use Title Case"
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]*$"

  regal-paths-kebab-case:
    description: Path segments must use kebab-case
    message: "Path segment in '{{property}}' must use kebab-case"
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z][a-z0-9-]*(/(\\{[a-zA-Z]+\\}|[a-z][a-z0-9-]*))*)*$"

  regal-v1-prefix:
    description: All paths must be prefixed with /v1/
    message: "Path '{{property}}' must be prefixed with /v1/"
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^/v1/"

  regal-requires-api-key-security:
    description: All operations must require the ApiKeyAuth security scheme
    message: "Operation '{{property}}' must use ApiKeyAuth security"
    severity: error
    given: "$.paths[*][*]"
    then:
      field: security
      function: truthy

  regal-operations-have-summaries:
    description: All operations must have a summary
    message: "Operation '{{property}}' is missing a summary"
    severity: error
    given: "$.paths[*][*]"
    then:
      field: summary
      function: truthy

  regal-response-200-has-schema:
    description: Successful GET responses must define a schema
    message: "GET operation '{{property}}' 200 response must define a schema"
    severity: warn
    given: "$.paths[*].get.responses.200.content[*]"
    then:
      field: schema
      function: truthy

  regal-error-schema-defined:
    description: Error responses must reference the Error schema
    message: "Error response must include a schema"
    severity: warn
    given: "$.paths[*][*].responses[?(@property >= '400')].content[*]"
    then:
      field: schema
      function: truthy