Tripetto · API Governance Rules

Tripetto API Rules

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

8 Rules error 2 warn 5 info 1
View Rules File View on GitHub

Rule Categories

tripetto

Rules

warn
tripetto-operation-id-format
Operation IDs must use camelCase
$.paths[*][*].operationId
warn
tripetto-require-tags
All operations must have at least one tag
$.paths[*][*]
warn
tripetto-response-200-has-content
200 responses must have a content body
$.paths[*][*].responses['200']
warn
tripetto-require-description
All operations must have a description
$.paths[*][*]
warn
tripetto-path-kebab-case
Path segments must use kebab-case
$.paths[*]~
error
tripetto-no-trailing-slash
Paths must not have trailing slashes
$.paths[*]~
error
tripetto-bearer-auth-defined
API must define Bearer authentication scheme
$.components.securitySchemes
info
tripetto-schema-properties-have-description
Schema properties should have descriptions
$.components.schemas[*].properties[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  # Tripetto API Convention Rules

  tripetto-operation-id-format:
    description: Operation IDs must use camelCase
    message: "Operation ID '{{value}}' must use camelCase (e.g. listForms, createForm)"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  tripetto-require-tags:
    description: All operations must have at least one tag
    message: Operations must be tagged for grouping (Forms, Responses, Webhooks)
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  tripetto-response-200-has-content:
    description: 200 responses must have a content body
    message: Successful responses should return content
    severity: warn
    given: "$.paths[*][*].responses['200']"
    then:
      field: content
      function: truthy

  tripetto-require-description:
    description: All operations must have a description
    message: Operations must have a description explaining their purpose
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: description
      function: truthy

  tripetto-path-kebab-case:
    description: Path segments must use kebab-case
    message: "Path '{{value}}' must use kebab-case for all segments"
    severity: warn
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}-]+)+$"

  tripetto-no-trailing-slash:
    description: Paths must not have trailing slashes
    message: "Path '{{value}}' must not end with a trailing slash"
    severity: error
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        notMatch: "/$"

  tripetto-bearer-auth-defined:
    description: API must define Bearer authentication scheme
    message: Security scheme BearerAuth must be defined in components
    severity: error
    given: "$.components.securitySchemes"
    then:
      field: BearerAuth
      function: truthy

  tripetto-schema-properties-have-description:
    description: Schema properties should have descriptions
    message: "Property '{{path}}' is missing a description"
    severity: info
    given: "$.components.schemas[*].properties[*]"
    then:
      field: description
      function: truthy