Olo · API Governance Rules

Olo API Rules

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

36 Rules error 8 warn 18 info 10
View Rules File View on GitHub

Rule Categories

error external get info no openapi operation parameter path paths request response schema security servers tag tags

Rules

error
info-title-required
API must have a title.
$.info
warn
info-title-olo-prefix
API title should begin with "Olo".
$.info.title
warn
info-description-required
API must have a meaningful description (min 40 chars).
$.info
error
info-version-required
API must declare a version.
$.info
info
info-contact-required
API should declare a contact.
$.info
warn
openapi-version-3-1
Specs should use OpenAPI 3.1.x.
$.openapi
error
servers-defined
At least one server must be defined.
$.servers
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths.*~
warn
paths-lowercase
Path segments should be lowercase (Olo uses lowercase resource paths).
$.paths.*~
error
paths-no-query-string
Paths must not contain query strings.
$.paths.*~
warn
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-title-case
Operation summaries should be Title Case.
$.paths[*][get,post,put,patch,delete].summary
info
operation-description-required
Every operation should have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-operationid-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-camelcase
operationId should be camelCase (Olo convention, e.g. createAccount).
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
Every operation must have at least one tag.
$.paths[*][get,post,put,patch,delete]
info
tags-defined-globally
A global tags array should be defined.
$
warn
tag-title-case
Tag names should be Title Case (e.g. "Accounts", "Promotions").
$.tags[*].name
warn
parameter-description-required
Parameters should have descriptions.
$.paths[*][*].parameters[*]
info
parameter-camelcase
Parameter names should be camelCase (Olo convention, e.g. membershipNumber).
$.paths[*][*].parameters[*].name
warn
request-body-json
Request bodies should offer application/json content.
$.paths[*][post,put,patch,delete].requestBody.content
error
response-success-defined
Operations must define a successful (200/201/204) response.
$.paths[*][get,post,put,patch,delete].responses
info
response-unauthorized-defined
Signature-authorized operations should document a 401 response.
$.paths[*][get,post,put,patch,delete].responses
warn
response-description-required
Every response must have a description.
$.paths[*][*].responses[*]
info
schema-property-camelcase
Schema property names should be camelCase (Olo convention).
$.components.schemas[*].properties.*~
info
schema-description-required
Top-level component schemas should have descriptions.
$.components.schemas[*]
warn
security-scheme-defined
Security schemes must be defined.
$.components.securitySchemes
info
security-scheme-described
Security schemes should describe the auth mechanism (Olo uses HMAC signatures).
$.components.securitySchemes[*]
error
get-no-request-body
GET operations must not declare a request body.
$.paths[*].get
info
external-docs-encouraged
APIs should link to external documentation (the Olo Developer Portal).
$
warn
path-params-casing
Path parameters should be camelCase (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (ErrorResponse) should be defined for error payloads.
$.components.schemas
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# olo — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - path-params-casing: camel @ 100% (n=3)
#   - operationid-casing: camel @ 100% (n=12)
#   - schema-names-casing: pascal @ 100% (n=35)
#   - schema-properties-casing: snake @ 79% (n=131)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: ErrorResponse
#   - operation-documents-401: 100% adherence
#   - merge: kept 31 existing, added 5 measured, upgraded 0
#   - added: path-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-required:
    description: API must have a title.
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-title-olo-prefix:
    description: API title should begin with "Olo".
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Olo
  info-description-required:
    description: API must have a meaningful description (min 40 chars).
    severity: warn
    given: $.info
    then:
      field: description
      function: length
      functionOptions:
        min: 40
  info-version-required:
    description: API must declare a version.
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  info-contact-required:
    description: API should declare a contact.
    severity: info
    given: $.info
    then:
      field: contact
      function: truthy
  openapi-version-3-1:
    description: Specs should use OpenAPI 3.1.x.
    severity: warn
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: ^3\.1\.
  servers-defined:
    description: At least one server must be defined.
    severity: error
    given: $.servers
    then:
      function: truthy
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-no-trailing-slash:
    description: Paths must not end with a trailing slash.
    severity: warn
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        notMatch: .+/$
  paths-lowercase:
    description: Path segments should be lowercase (Olo uses lowercase resource paths).
    severity: warn
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        match: ^[a-z0-9/_.{}-]+$
  paths-no-query-string:
    description: Paths must not contain query strings.
    severity: error
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        notMatch: \?
  operation-summary-required:
    description: Every operation must have a summary.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  operation-summary-title-case:
    description: Operation summaries should be Title Case.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z]
  operation-description-required:
    description: Every operation should have a description.
    severity: info
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  operation-operationid-required:
    description: Every operation must have an operationId.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  operation-operationid-camelcase:
    description: operationId should be camelCase (Olo convention, e.g. createAccount).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]+$
  operation-tags-required:
    description: Every operation must have at least one tag.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  tags-defined-globally:
    description: A global tags array should be defined.
    severity: info
    given: $
    then:
      field: tags
      function: truthy
  tag-title-case:
    description: Tag names should be Title Case (e.g. "Accounts", "Promotions").
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9 ]*$
  parameter-description-required:
    description: Parameters should have descriptions.
    severity: warn
    given: $.paths[*][*].parameters[*]
    then:
      field: description
      function: truthy
  parameter-camelcase:
    description: Parameter names should be camelCase (Olo convention, e.g. membershipNumber).
    severity: info
    given: $.paths[*][*].parameters[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[a-zA-Z][a-zA-Z0-9]*$
  request-body-json:
    description: Request bodies should offer application/json content.
    severity: warn
    given: $.paths[*][post,put,patch,delete].requestBody.content
    then:
      field: application/json
      function: truthy
  response-success-defined:
    description: Operations must define a successful (200/201/204) response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
          - required:
            - '204'
  response-unauthorized-defined:
    description: Signature-authorized operations should document a 401 response.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  response-description-required:
    description: Every response must have a description.
    severity: warn
    given: $.paths[*][*].responses[*]
    then:
      field: description
      function: truthy
  schema-property-camelcase:
    description: Schema property names should be camelCase (Olo convention).
    severity: info
    given: $.components.schemas[*].properties.*~
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  schema-description-required:
    description: Top-level component schemas should have descriptions.
    severity: info
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  security-scheme-defined:
    description: Security schemes must be defined.
    severity: warn
    given: $.components.securitySchemes
    then:
      function: truthy
  security-scheme-described:
    description: Security schemes should describe the auth mechanism (Olo uses HMAC signatures).
    severity: info
    given: $.components.securitySchemes[*]
    then:
      field: description
      function: truthy
  get-no-request-body:
    description: GET operations must not declare a request body.
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  external-docs-encouraged:
    description: APIs should link to external documentation (the Olo Developer Portal).
    severity: info
    given: $
    then:
      field: externalDocs
      function: truthy
  path-params-casing:
    description: Path parameters should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: camel
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  error-schema-defined:
    description: A shared error schema (ErrorResponse) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: ErrorResponse
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy