OpenMenu · API Governance Rules

OpenMenu API Rules

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

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

Rule Categories

openmenu

Rules

error
openmenu-server-base-url
Servers must use the OpenMenu API v2 base URL.
$.servers[*].url
error
openmenu-apikey-query-auth
OpenMenu authenticates via the `key` query parameter, not a header or Bearer token.
$.components.securitySchemes[*]
warn
openmenu-summary-title-case
Operation summaries should be present and Title Case.
$.paths[*][get].summary
error
openmenu-operationid-required
Every operation must declare an operationId.
$.paths[*][get]
warn
openmenu-country-required
Location-scoped operations should require an ISO 3166-1 alpha-2 country.
$.paths[*][get].parameters[?(@.name=='country')]
warn
openmenu-standard-error-responses
Operations should document 400, 402, and 429 error responses.
$.paths[*][get].responses
warn
openmenu-tags-title-case
Tags must be Title Case.
$.tags[*].name

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, recommended]]
documentationUrl: https://www.openmenu.com/api/docs/
rules:
  openmenu-server-base-url:
    description: Servers must use the OpenMenu API v2 base URL.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://www\\.openmenu\\.com/api/v2$"

  openmenu-apikey-query-auth:
    description: OpenMenu authenticates via the `key` query parameter, not a header or Bearer token.
    severity: error
    given: $.components.securitySchemes[*]
    then:
      - field: type
        function: pattern
        functionOptions:
          match: "^apiKey$"
      - field: in
        function: pattern
        functionOptions:
          match: "^query$"
      - field: name
        function: pattern
        functionOptions:
          match: "^key$"

  openmenu-summary-title-case:
    description: Operation summaries should be present and Title Case.
    severity: warn
    given: $.paths[*][get].summary
    then:
      function: truthy

  openmenu-operationid-required:
    description: Every operation must declare an operationId.
    severity: error
    given: $.paths[*][get]
    then:
      field: operationId
      function: truthy

  openmenu-country-required:
    description: Location-scoped operations should require an ISO 3166-1 alpha-2 country.
    severity: warn
    given: $.paths[*][get].parameters[?(@.name=='country')]
    then:
      field: required
      function: truthy

  openmenu-standard-error-responses:
    description: Operations should document 400, 402, and 429 error responses.
    severity: warn
    given: $.paths[*][get].responses
    then:
      - field: "400"
        function: truthy
      - field: "429"
        function: truthy

  openmenu-tags-title-case:
    description: Tags must be Title Case.
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z]+( [A-Z][A-Za-z]+)*$"