Modal · API Governance Rules

Modal API Rules

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

7 Rules error 4 warn 3
View Rules File View on GitHub

Rule Categories

modal

Rules

error
modal-info-title-set
Modal OpenAPI documents must have a descriptive title that mentions Modal.
$.info.title
error
modal-info-version-set
Modal OpenAPI documents must specify a version.
$.info
error
modal-servers-present
Modal OpenAPI documents must declare at least one server.
$.servers
warn
modal-operation-summary-title-case
Operation summaries should use Title Case.
$.paths..[?(@.summary)]
warn
modal-operation-id-camel-case
Operation IDs should be camelCase.
$.paths..[?(@.operationId)]
error
modal-bearer-security
Every Modal operation must require ModalToken bearer auth.
$.security
warn
modal-tag-defined
All operations must be tagged.
$.paths..[?(@.tags)]

Spectral Ruleset

Raw ↑
extends: spectral:oas
formats:
  - oas3_1
rules:
  modal-info-title-set:
    description: Modal OpenAPI documents must have a descriptive title that mentions Modal.
    given: $.info.title
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "(?i)modal"
  modal-info-version-set:
    description: Modal OpenAPI documents must specify a version.
    given: $.info
    severity: error
    then:
      field: version
      function: truthy
  modal-servers-present:
    description: Modal OpenAPI documents must declare at least one server.
    given: $.servers
    severity: error
    then:
      function: length
      functionOptions:
        min: 1
  modal-operation-summary-title-case:
    description: Operation summaries should use Title Case.
    given: $.paths..[?(@.summary)]
    severity: warn
    then:
      field: summary
      function: pattern
      functionOptions:
        match: "^[A-Z]"
  modal-operation-id-camel-case:
    description: Operation IDs should be camelCase.
    given: $.paths..[?(@.operationId)]
    severity: warn
    then:
      field: operationId
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"
  modal-bearer-security:
    description: Every Modal operation must require ModalToken bearer auth.
    given: $.security
    severity: error
    then:
      function: truthy
  modal-tag-defined:
    description: All operations must be tagged.
    given: $.paths..[?(@.tags)]
    severity: warn
    then:
      field: tags
      function: length
      functionOptions:
        min: 1