Reflect · API Governance Rules

Reflect API Rules

Spectral linting rules defining API design standards and conventions for Reflect.

6 Rules error 2 warn 3 info 1
View Rules File View on GitHub

Rule Categories

reflect

Rules

warn
reflect-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
warn
reflect-api-key-auth
Reflect API uses X-API-KEY header authentication.
$.components.securitySchemes[*][?(@.type=='apiKey')]
warn
reflect-tags-defined
All operations must include at least one tag.
$.paths[*][*]
error
reflect-servers-defined
API must define at least one server.
$
error
reflect-response-200-defined
All operations must define a 200 success response.
$.paths[*][*].responses
info
reflect-integer-ids
Reflect uses integer IDs for tests and executions (not UUIDs). Path parameters should reflect this.
$.paths[*][*].parameters[?(@.in=='path')]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  reflect-operation-summary-title-case:
    description: All operation summaries must use Title Case.
    message: "Operation summary '{{value}}' must use Title Case."
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 '\\-]*$"

  reflect-api-key-auth:
    description: Reflect API uses X-API-KEY header authentication.
    message: "Security scheme must use apiKey in header with name X-API-KEY."
    severity: warn
    given: "$.components.securitySchemes[*][?(@.type=='apiKey')]"
    then:
      field: name
      function: pattern
      functionOptions:
        match: "^X-API-KEY$"

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

  reflect-servers-defined:
    description: API must define at least one server.
    message: "API must have at least one server defined."
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  reflect-response-200-defined:
    description: All operations must define a 200 success response.
    message: "Operation must define a 200 response."
    severity: error
    given: "$.paths[*][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          required: ["200"]

  reflect-integer-ids:
    description: >-
      Reflect uses integer IDs for tests and executions (not UUIDs).
      Path parameters should reflect this.
    message: "Path parameter for ID should use type integer."
    severity: info
    given: "$.paths[*][*].parameters[?(@.in=='path')]"
    then:
      field: schema.type
      function: enumeration
      functionOptions:
        values: ["integer", "string"]