Walt Disney · API Governance Rules

Walt Disney API Rules

Spectral linting rules defining API design standards and conventions for Walt Disney.

9 Rules error 5 warn 4
View Rules File View on GitHub

Rule Categories

disney

Rules

error
disney-operation-ids-required
All operations must have an operationId
$.paths[*][*]
warn
disney-operation-summary-title-case
Operation summaries must use Title Case
$.paths[*][*].summary
error
disney-operation-tags-required
All operations must have at least one tag
$.paths[*][*]
warn
disney-pagination-parameters
List endpoints should support page and pageSize parameters
$.paths[*].get.parameters
error
disney-info-description
Info object must have a description
$.info
error
disney-response-200-defined
GET operations must define a 200 response
$.paths[*].get.responses
warn
disney-response-schema-reference
Successful responses should reference a schema
$.paths[*][*].responses['200'].content['application/json']
warn
disney-schemas-in-components
Schemas should be defined in components for reuse
$.components
error
disney-server-defined
At least one server must be defined
$

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  disney-operation-ids-required:
    description: All operations must have an operationId
    severity: error
    given: "$.paths[*][*]"
    then:
      field: operationId
      function: truthy

  disney-operation-summary-title-case:
    description: Operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*(\\s[A-Z][a-zA-Z0-9]*)*$"

  disney-operation-tags-required:
    description: All operations must have at least one tag
    severity: error
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  disney-pagination-parameters:
    description: List endpoints should support page and pageSize parameters
    severity: warn
    given: "$.paths[*].get.parameters"
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            type: object
            properties:
              name:
                enum:
                  - page
                  - pageSize

  disney-info-description:
    description: Info object must have a description
    severity: error
    given: "$.info"
    then:
      field: description
      function: truthy

  disney-response-200-defined:
    description: GET operations must define a 200 response
    severity: error
    given: "$.paths[*].get.responses"
    then:
      field: "200"
      function: truthy

  disney-response-schema-reference:
    description: Successful responses should reference a schema
    severity: warn
    given: "$.paths[*][*].responses['200'].content['application/json']"
    then:
      field: schema
      function: truthy

  disney-schemas-in-components:
    description: Schemas should be defined in components for reuse
    severity: warn
    given: "$.components"
    then:
      field: schemas
      function: truthy

  disney-server-defined:
    description: At least one server must be defined
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy