Telefon · API Governance Rules

Telefon API Rules

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

9 Rules error 3 warn 4 info 2
View Rules File View on GitHub

Rule Categories

telefon

Rules

warn
telefon-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
error
telefon-operation-must-have-operationid
All operations must have an operationId
$.paths[*][*]
warn
telefon-operationid-camelcase
Operation IDs must use camelCase
$.paths[*][*].operationId
info
telefon-operation-must-have-description
All operations should have a description
$.paths[*][*]
warn
telefon-operation-must-have-tag
All operations must have at least one tag
$.paths[*][*]
error
telefon-response-200-required
GET operations must define a 200 response
$.paths[*].get.responses
warn
telefon-delete-204-response
DELETE operations should return 204
$.paths[*].delete.responses
info
telefon-schema-properties-have-description
Schema properties should have descriptions
$.components.schemas[*].properties[*]
error
telefon-servers-required
API must define servers
$

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  telefon-operation-summary-title-case:
    description: All operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-z0-9]*([ ][A-Z][a-z0-9]*)*|[A-Z]+)$"

  telefon-operation-must-have-operationid:
    description: All operations must have an operationId
    severity: error
    given: "$.paths[*][*]"
    then:
      field: operationId
      function: truthy

  telefon-operationid-camelcase:
    description: Operation IDs must use camelCase
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  telefon-operation-must-have-description:
    description: All operations should have a description
    severity: info
    given: "$.paths[*][*]"
    then:
      field: description
      function: truthy

  telefon-operation-must-have-tag:
    description: All operations must have at least one tag
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  telefon-response-200-required:
    description: GET operations must define a 200 response
    severity: error
    given: "$.paths[*].get.responses"
    then:
      field: "200"
      function: truthy

  telefon-delete-204-response:
    description: DELETE operations should return 204
    severity: warn
    given: "$.paths[*].delete.responses"
    then:
      field: "204"
      function: truthy

  telefon-schema-properties-have-description:
    description: Schema properties should have descriptions
    severity: info
    given: "$.components.schemas[*].properties[*]"
    then:
      field: description
      function: truthy

  telefon-servers-required:
    description: API must define servers
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy