Telesign · API Governance Rules

Telesign API Rules

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

12 Rules error 4 warn 7
View Rules File View on GitHub

Rule Categories

telesign

Rules

warn
telesign-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
error
telesign-operation-must-have-operationid
All operations must have an operationId
$.paths[*][*]
warn
telesign-operationid-kebab-case
Operation IDs should use camelCase
$.paths[*][*].operationId
hint
telesign-phone-number-parameter
Phone number parameters should be named 'phone_number' or 'complete_phone_number' and include country code in their description
$.paths[*][*].parameters[?(@.name == 'phone_number' || @.name == 'complete_phone_number')]
warn
telesign-reference-id-response
Successful responses should include a reference_id field for transaction tracking
$.paths[*].post.responses.200.content['application/json'].schema.properties
warn
telesign-status-object-in-response
Successful responses should include a status object with code and description
$.paths[*].post.responses.200.content['application/json'].schema.properties
error
telesign-requires-basic-auth
All paths must require BasicAuth security
$.paths[*][*]
error
telesign-server-must-be-telesign
Server URL must point to rest-ww.telesign.com
$.servers[*].url
warn
telesign-response-must-have-400
POST operations must handle 400 Bad Request
$.paths[*].post.responses
error
telesign-response-must-have-401
All operations must handle 401 Unauthorized
$.paths[*][*].responses
warn
telesign-response-must-have-429
POST operations must handle 429 rate limiting
$.paths[*].post.responses
warn
telesign-account-lifecycle-enum
account_lifecycle_event must use the approved enum values
$.paths[*][*]..properties.account_lifecycle_event

Spectral Ruleset

Raw ↑
rules:
  telesign-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-zA-Z0-9 ]*$"

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

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

  telesign-phone-number-parameter:
    description: >-
      Phone number parameters should be named 'phone_number' or 'complete_phone_number'
      and include country code in their description
    severity: hint
    given: "$.paths[*][*].parameters[?(@.name == 'phone_number' || @.name == 'complete_phone_number')]"
    then:
      field: description
      function: truthy

  telesign-reference-id-response:
    description: >-
      Successful responses should include a reference_id field for transaction tracking
    severity: warn
    given: "$.paths[*].post.responses.200.content['application/json'].schema.properties"
    then:
      field: reference_id
      function: truthy

  telesign-status-object-in-response:
    description: >-
      Successful responses should include a status object with code and description
    severity: warn
    given: "$.paths[*].post.responses.200.content['application/json'].schema.properties"
    then:
      field: status
      function: truthy

  telesign-requires-basic-auth:
    description: All paths must require BasicAuth security
    severity: error
    given: "$.paths[*][*]"
    then:
      field: security
      function: truthy

  telesign-server-must-be-telesign:
    description: Server URL must point to rest-ww.telesign.com
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://rest-ww\\.telesign\\.com"

  telesign-response-must-have-400:
    description: POST operations must handle 400 Bad Request
    severity: warn
    given: "$.paths[*].post.responses"
    then:
      field: '400'
      function: truthy

  telesign-response-must-have-401:
    description: All operations must handle 401 Unauthorized
    severity: error
    given: "$.paths[*][*].responses"
    then:
      field: '401'
      function: truthy

  telesign-response-must-have-429:
    description: POST operations must handle 429 rate limiting
    severity: warn
    given: "$.paths[*].post.responses"
    then:
      field: '429'
      function: truthy

  telesign-account-lifecycle-enum:
    description: >-
      account_lifecycle_event must use the approved enum values
    severity: warn
    given: "$.paths[*][*]..properties.account_lifecycle_event"
    then:
      field: enum
      function: truthy