Teledyne Technologies · API Governance Rules

Teledyne Technologies API Rules

Spectral linting rules defining API design standards and conventions for Teledyne Technologies.

10 Rules error 3 warn 6
View Rules File View on GitHub

Rule Categories

teledyne

Rules

warn
teledyne-operation-ids-camel-case
Operation IDs must use camelCase naming convention.
$.paths[*][*].operationId
error
teledyne-operations-have-summaries
All operations must have a summary.
$.paths[*][*]
warn
teledyne-title-case-summaries
Operation summaries must use Title Case.
$.paths[*][*].summary
warn
teledyne-operations-have-tags
All operations must be tagged.
$.paths[*][*]
error
teledyne-responses-have-descriptions
All responses must have descriptions.
$.paths[*][*].responses[*]
error
teledyne-servers-defined
API must define at least one server.
$
warn
teledyne-path-parameters-described
All path parameters must have descriptions.
$.paths[*][*].parameters[?(@.in === 'path')]
warn
teledyne-json-responses-defined
JSON-returning endpoints must define response schemas.
$.paths[*][*].responses[200].content.application/json
hint
teledyne-temp-unit-enum
Temperature unit parameters should use standard C/F/K enum.
$.paths[*][*].parameters[?(@.name === 'tempUnit')]
warn
teledyne-components-schemas
API must define reusable schemas.
$.components

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas

rules:
  teledyne-operation-ids-camel-case:
    description: Operation IDs must use camelCase naming convention.
    message: "Operation ID '{{value}}' must use camelCase."
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  teledyne-operations-have-summaries:
    description: All operations must have a summary.
    message: "Operation must include a summary."
    severity: error
    given: "$.paths[*][*]"
    then:
      field: summary
      function: truthy

  teledyne-title-case-summaries:
    description: Operation summaries must use Title Case.
    message: "Summary '{{value}}' should use Title Case."
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]*$"

  teledyne-operations-have-tags:
    description: All operations must be tagged.
    message: "Operation must have at least one tag."
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  teledyne-responses-have-descriptions:
    description: All responses must have descriptions.
    message: "Response must include a description."
    severity: error
    given: "$.paths[*][*].responses[*]"
    then:
      field: description
      function: truthy

  teledyne-servers-defined:
    description: API must define at least one server.
    message: "API must include a servers array with at least one entry."
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  teledyne-path-parameters-described:
    description: All path parameters must have descriptions.
    message: "Path parameter must include a description."
    severity: warn
    given: "$.paths[*][*].parameters[?(@.in === 'path')]"
    then:
      field: description
      function: truthy

  teledyne-json-responses-defined:
    description: JSON-returning endpoints must define response schemas.
    message: "JSON response should define a schema."
    severity: warn
    given: "$.paths[*][*].responses[200].content.application/json"
    then:
      field: schema
      function: truthy

  teledyne-temp-unit-enum:
    description: Temperature unit parameters should use standard C/F/K enum.
    message: "Temperature unit should be one of: C, F, K."
    severity: hint
    given: "$.paths[*][*].parameters[?(@.name === 'tempUnit')]"
    then:
      field: schema
      function: truthy

  teledyne-components-schemas:
    description: API must define reusable schemas.
    message: "API should define schemas in components/schemas."
    severity: warn
    given: "$.components"
    then:
      field: schemas
      function: truthy