Tripleseat · API Governance Rules

Tripleseat API Rules

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

39 Rules error 7 warn 26 info 6
View Rules File View on GitHub

Rule Categories

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

Rules

warn
info-title-prefix
API title should start with "Tripleseat".
$.info.title
warn
info-description-required
API must have a description of at least 40 characters.
$.info
warn
info-contact-required
API must declare a contact.
$.info
warn
openapi-version-31
Specs should target OpenAPI 3.1.0.
$.openapi
error
servers-defined
At least one server must be defined.
$.servers
error
servers-https
Servers must use HTTPS.
$.servers[*].url
info
servers-tripleseat-host
Production server should be api.tripleseat.com.
$.servers[*].url
warn
paths-version-prefix
Paths should be versioned under /v1.
$.paths[*]~
warn
paths-snake-case
Path segments should be lowercase snake_case (allowing path params and .json suffix).
$.paths[*]~
error
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths[*]~
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-title-case
Operation summaries should be in Title Case.
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-id-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-id-camel-case-verb
operationId should be camelCase and start with a verb (get/list/create/update/delete/search).
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
info
tags-global-defined
A global tags array should be defined.
$
warn
tag-description-required
Each global tag should have a description.
$.tags[*]
warn
tag-title-case
Tag names should be in Title Case.
$.tags[*].name
warn
parameter-description-required
Every parameter should have a description.
$.paths[*][*].parameters[*]
warn
parameter-snake-case
Parameter names should be snake_case.
$.paths[*][*].parameters[*].name
info
parameter-pagination-page
Pagination should use the page parameter.
$.paths[*][*].parameters[?(@.in=='query' && (@.name=='offset' || @.name=='limit' || @.name=='cursor'))]
warn
request-body-json
Request bodies should support application/json.
$.paths[*][post,put,patch].requestBody.content
error
response-success-defined
Each operation must define a 2xx response.
$.paths[*][get,post,put,patch,delete].responses
info
response-unauthorized-defined
Operations should define a 401 response.
$.paths[*][get,post,put,patch,delete].responses
warn
error-schema-message
The Error schema should expose an error field.
$.components.schemas.Error.properties
warn
schema-property-snake-case
Schema property names should be snake_case (X-Signature header is exempt).
$.components.schemas[*].properties[*]~
info
schema-id-integer
id properties should be typed as integer.
$.components.schemas[*].properties.id
warn
security-global-defined
A global security requirement should be defined.
$
warn
security-oauth2-scheme
An oauth2 security scheme should be defined.
$.components.securitySchemes
error
get-no-request-body
GET operations must not declare a request body.
$.paths[*].get
warn
post-put-request-body
POST and PUT operations should declare a request body.
$.paths[*][post,put]
info
examples-encouraged
Operations are encouraged to provide response examples.
$.paths[*][get,post,put,patch,delete].responses[*].content.application/json
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
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 (Error) should be defined for error payloads.
$.components.schemas
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# tripleseat — 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)
#   - servers-expected-domain: 1/1 servers on tripleseat.com
#   - path-params-casing: snake @ 100% (n=5)
#   - query-params-casing: snake @ 100% (n=12)
#   - operationid-casing: camel @ 100% (n=15)
#   - schema-names-casing: pascal @ 100% (n=11)
#   - schema-properties-casing: snake @ 100% (n=85)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: Error
#   - operation-documents-401: 100% adherence
#   - pagination params observed: ['page']
#   - merge: kept 33 existing, added 6 measured, upgraded 0
#   - added: path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-prefix:
    description: API title should start with "Tripleseat".
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Tripleseat
  info-description-required:
    description: API must have a description of at least 40 characters.
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  info-contact-required:
    description: API must declare a contact.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  openapi-version-31:
    description: Specs should target OpenAPI 3.1.0.
    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:
    description: Servers must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-tripleseat-host:
    description: Production server should be api.tripleseat.com.
    severity: info
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: api\.tripleseat\.com
  paths-version-prefix:
    description: Paths should be versioned under /v1.
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^/v1/
  paths-snake-case:
    description: Path segments should be lowercase snake_case (allowing path params and .json suffix).
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/v1)?(/[a-z0-9_]+(\.[a-z]+)?|/\{[a-z_]+\}(\.[a-z]+)?)+$
  paths-no-trailing-slash:
    description: Paths must not end with a trailing slash.
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: .+/$
  operation-summary-required:
    description: Every operation must have a summary.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  operation-summary-title-case:
    description: Operation summaries should be in Title Case.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*(\s[A-Z0-9][A-Za-z0-9]*)*$
  operation-description-required:
    description: Every operation must have a description.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  operation-id-required:
    description: Every operation must have an operationId.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  operation-id-camel-case-verb:
    description: operationId should be camelCase and start with a verb (get/list/create/update/delete/search).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^(get|list|create|update|delete|search)[A-Z][A-Za-z0-9]*$
  operation-tags-required:
    description: Every operation must declare at least one tag.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  tags-global-defined:
    description: A global tags array should be defined.
    severity: info
    given: $
    then:
      field: tags
      function: truthy
  tag-description-required:
    description: Each global tag should have a description.
    severity: warn
    given: $.tags[*]
    then:
      field: description
      function: truthy
  tag-title-case:
    description: Tag names should be in Title Case.
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*(\s[A-Z0-9][A-Za-z0-9]*)*$
  parameter-description-required:
    description: Every parameter should have a description.
    severity: warn
    given: $.paths[*][*].parameters[*]
    then:
      field: description
      function: truthy
  parameter-snake-case:
    description: Parameter names should be snake_case.
    severity: warn
    given: $.paths[*][*].parameters[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  parameter-pagination-page:
    description: Pagination should use the page parameter.
    severity: info
    given: $.paths[*][*].parameters[?(@.in=='query' && (@.name=='offset' || @.name=='limit' || @.name=='cursor'))]
    then:
      function: falsy
  request-body-json:
    description: Request bodies should support application/json.
    severity: warn
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      field: application/json
      function: truthy
  response-success-defined:
    description: Each operation must define a 2xx response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
          - required:
            - '202'
          - required:
            - '204'
  response-unauthorized-defined:
    description: Operations should define a 401 response.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  error-schema-message:
    description: The Error schema should expose an error field.
    severity: warn
    given: $.components.schemas.Error.properties
    then:
      field: error
      function: truthy
  schema-property-snake-case:
    description: Schema property names should be snake_case (X-Signature header is exempt).
    severity: warn
    given: $.components.schemas[*].properties[*]~
    then:
      function: pattern
      functionOptions:
        match: ^([a-z][a-z0-9_]*|X-Signature)$
  schema-id-integer:
    description: id properties should be typed as integer.
    severity: info
    given: $.components.schemas[*].properties.id
    then:
      field: type
      function: truthy
  security-global-defined:
    description: A global security requirement should be defined.
    severity: warn
    given: $
    then:
      field: security
      function: truthy
  security-oauth2-scheme:
    description: An oauth2 security scheme should be defined.
    severity: warn
    given: $.components.securitySchemes
    then:
      field: oauth2
      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
  post-put-request-body:
    description: POST and PUT operations should declare a request body.
    severity: warn
    given: $.paths[*][post,put]
    then:
      field: requestBody
      function: truthy
  examples-encouraged:
    description: Operations are encouraged to provide response examples.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses[*].content.application/json
    then:
      field: examples
      function: truthy
  path-params-casing:
    description: Path parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: snake
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  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: warn
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  error-schema-defined:
    description: A shared error schema (Error) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: Error
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy