Teradata · API Governance Rules

Teradata API Rules

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

30 Rules error 13 warn 13 info 4
View Rules File View on GitHub

Rule Categories

delete examples get info no openapi operation parameter paths post response schema security servers

Rules

error
info-title-required
Info title must be present.
$.info
warn
info-title-prefix
Info title should start with Teradata.
$.info.title
error
info-description-required
Info description must be present.
$.info
error
info-version-required
Info version must be present.
$.info
warn
info-contact-required
Contact information should be provided.
$.info
warn
openapi-version
OpenAPI version should be 3.0.x.
$
error
servers-defined
Servers array must be defined.
$
warn
servers-https
Server URLs should use HTTPS.
$.servers[*].url
warn
paths-kebab-case
Path segments should use kebab-case.
$.paths
error
paths-no-trailing-slash
Paths should not have trailing slashes.
$.paths
error
operation-operationid-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-prefix
Operation summaries should start with Teradata.
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete]
warn
operation-tags-required
Every operation must have tags.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-camelcase
OperationId should be camelCase.
$.paths[*][get,post,put,patch,delete].operationId
warn
parameter-description-required
Every parameter must have a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
info
parameter-camelcase
Parameter names should use camelCase.
$.paths[*][get,post,put,patch,delete].parameters[*].name
error
response-success-required
Operations must have a success response (2xx).
$.paths[*][get,post,put,patch,delete].responses
warn
response-description-required
Every response must have a description.
$.paths[*][get,post,put,patch,delete].responses[*]
info
schema-properties-camelcase
Schema property names should use camelCase.
$.components.schemas[*].properties
warn
schema-description-required
Top-level schemas should have descriptions.
$.components.schemas[*]
error
schema-type-required
Schemas must have a type defined.
$.components.schemas[*]
error
security-defined
Global security must be defined.
$
error
security-schemes-defined
Security schemes must be defined in components.
$.components
error
get-no-request-body
GET operations should not have a request body.
$.paths[*].get
warn
delete-no-request-body
DELETE operations should not have a request body.
$.paths[*].delete
info
post-request-body-required
POST operations should have a request body.
$.paths[*].post
error
no-empty-descriptions
Descriptions must not be empty strings.
$..description
info
examples-encouraged
Schema properties should include example values.
$.components.schemas[*].properties[*]

Spectral Ruleset

Raw ↑
rules:
  # INFO / METADATA
  info-title-required:
    description: Info title must be present.
    given: $.info
    severity: error
    then:
      field: title
      function: truthy

  info-title-prefix:
    description: Info title should start with Teradata.
    given: $.info.title
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^Teradata "

  info-description-required:
    description: Info description must be present.
    given: $.info
    severity: error
    then:
      field: description
      function: truthy

  info-version-required:
    description: Info version must be present.
    given: $.info
    severity: error
    then:
      field: version
      function: truthy

  info-contact-required:
    description: Contact information should be provided.
    given: $.info
    severity: warn
    then:
      field: contact
      function: truthy

  # OPENAPI VERSION
  openapi-version:
    description: OpenAPI version should be 3.0.x.
    given: $
    severity: warn
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: "^3\\.0\\."

  # SERVERS
  servers-defined:
    description: Servers array must be defined.
    given: $
    severity: error
    then:
      field: servers
      function: truthy

  servers-https:
    description: Server URLs should use HTTPS.
    given: $.servers[*].url
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  # PATHS - NAMING CONVENTIONS
  paths-kebab-case:
    description: Path segments should use kebab-case.
    given: $.paths
    severity: warn
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9\\-{}]+)+$"

  paths-no-trailing-slash:
    description: Paths should not have trailing slashes.
    given: $.paths
    severity: error
    then:
      field: "@key"
      function: pattern
      functionOptions:
        notMatch: "/$"

  # OPERATIONS
  operation-operationid-required:
    description: Every operation must have an operationId.
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: error
    then:
      field: operationId
      function: truthy

  operation-summary-required:
    description: Every operation must have a summary.
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: error
    then:
      field: summary
      function: truthy

  operation-summary-prefix:
    description: Operation summaries should start with Teradata.
    given: "$.paths[*][get,post,put,patch,delete].summary"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^Teradata "

  operation-description-required:
    description: Every operation must have a description.
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: warn
    then:
      field: description
      function: truthy

  operation-tags-required:
    description: Every operation must have tags.
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: warn
    then:
      field: tags
      function: truthy

  operation-operationid-camelcase:
    description: OperationId should be camelCase.
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  # PARAMETERS
  parameter-description-required:
    description: Every parameter must have a description.
    given: "$.paths[*][get,post,put,patch,delete].parameters[*]"
    severity: warn
    then:
      field: description
      function: truthy

  parameter-camelcase:
    description: Parameter names should use camelCase.
    given: "$.paths[*][get,post,put,patch,delete].parameters[*].name"
    severity: info
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  # RESPONSES
  response-success-required:
    description: Operations must have a success response (2xx).
    given: "$.paths[*][get,post,put,patch,delete].responses"
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ["200"]
            - required: ["201"]
            - required: ["204"]

  response-description-required:
    description: Every response must have a description.
    given: "$.paths[*][get,post,put,patch,delete].responses[*]"
    severity: warn
    then:
      field: description
      function: truthy

  # SCHEMAS - PROPERTY NAMING
  schema-properties-camelcase:
    description: Schema property names should use camelCase.
    given: "$.components.schemas[*].properties"
    severity: info
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  schema-description-required:
    description: Top-level schemas should have descriptions.
    given: "$.components.schemas[*]"
    severity: warn
    then:
      field: description
      function: truthy

  schema-type-required:
    description: Schemas must have a type defined.
    given: "$.components.schemas[*]"
    severity: error
    then:
      field: type
      function: truthy

  # SECURITY
  security-defined:
    description: Global security must be defined.
    given: $
    severity: error
    then:
      field: security
      function: truthy

  security-schemes-defined:
    description: Security schemes must be defined in components.
    given: $.components
    severity: error
    then:
      field: securitySchemes
      function: truthy

  # HTTP METHOD CONVENTIONS
  get-no-request-body:
    description: GET operations should not have a request body.
    given: "$.paths[*].get"
    severity: error
    then:
      field: requestBody
      function: falsy

  delete-no-request-body:
    description: DELETE operations should not have a request body.
    given: "$.paths[*].delete"
    severity: warn
    then:
      field: requestBody
      function: falsy

  post-request-body-required:
    description: POST operations should have a request body.
    given: "$.paths[*].post"
    severity: info
    then:
      field: requestBody
      function: truthy

  # GENERAL QUALITY
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    given: "$..description"
    severity: error
    then:
      function: truthy

  examples-encouraged:
    description: Schema properties should include example values.
    given: "$.components.schemas[*].properties[*]"
    severity: info
    then:
      field: example
      function: truthy