Vonage · API Governance Rules

Vonage API Rules

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

11 Rules error 1 warn 4 info 6
View Rules File View on GitHub

Rule Categories

vonage

Rules

warn
vonage-operation-ids-camel-case
Operation IDs must use camelCase.
$.paths[*][*].operationId
warn
vonage-tags-title-case
Tags must use Title Case.
$.paths[*][*].tags[*]
error
vonage-operation-summary-required
All operations must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
vonage-operation-tags-required
All operations must have at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
vonage-response-200-defined
GET operations must define a 200 response.
$.paths[*].get
info
vonage-response-201-post
POST create operations should return 201.
$.paths[*].post
info
vonage-api-key-secret-in-body
Vonage REST API (rest.nexmo.com) uses api_key and api_secret in request body. Ensure these are documented as required fields.
$.paths[/sms/json,/account/numbers,/number/search,/number/buy,/number/cancel,/number/update][post,get].requestBody.content[*].schema.required
info
vonage-bearer-auth-voice
Voice API operations must use Bearer JWT authentication.
$.paths[/v1/calls,/v1/calls/*][*].security[*]
info
vonage-description-required
All operations should have a description.
$.paths[*][get,post,put,patch,delete]
info
vonage-path-kebab-case
API paths should use kebab-case segments.
$.paths
info
vonage-parameters-described
All parameters should have descriptions.
$.paths[*][*].parameters[*]

Spectral Ruleset

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

  vonage-tags-title-case:
    description: Tags must use Title Case.
    message: "Tag '{{value}}' must use Title Case."
    severity: warn
    given: "$.paths[*][*].tags[*]"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 \\-]*$"

  vonage-operation-summary-required:
    description: All operations must have a summary.
    message: "Operation must have a summary."
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: defined

  vonage-operation-tags-required:
    description: All operations must have at least one tag.
    message: "Operation must have at least one tag."
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: defined

  vonage-response-200-defined:
    description: GET operations must define a 200 response.
    message: "GET operation must define a 200 response."
    severity: warn
    given: "$.paths[*].get"
    then:
      field: responses.200
      function: defined

  vonage-response-201-post:
    description: POST create operations should return 201.
    message: "POST create operations should return 201."
    severity: info
    given: "$.paths[*].post"
    then:
      field: responses.201
      function: defined

  vonage-api-key-secret-in-body:
    description: >-
      Vonage REST API (rest.nexmo.com) uses api_key and api_secret in request body.
      Ensure these are documented as required fields.
    message: "api_key and api_secret should be documented as required for legacy REST endpoints."
    severity: info
    given: "$.paths[/sms/json,/account/numbers,/number/search,/number/buy,/number/cancel,/number/update][post,get].requestBody.content[*].schema.required"
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            type: string
            enum: [api_key]

  vonage-bearer-auth-voice:
    description: Voice API operations must use Bearer JWT authentication.
    message: "Voice API operations should use Bearer JWT auth."
    severity: info
    given: "$.paths[/v1/calls,/v1/calls/*][*].security[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required: [bearerAuth]

  vonage-description-required:
    description: All operations should have a description.
    message: "Operation should have a description."
    severity: info
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: description
      function: defined

  vonage-path-kebab-case:
    description: API paths should use kebab-case segments.
    message: "Path '{{path}}' should use kebab-case."
    severity: info
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(\\/[a-z0-9{}\\-._~]*)*$"

  vonage-parameters-described:
    description: All parameters should have descriptions.
    message: "Parameter '{{value}}' should have a description."
    severity: info
    given: "$.paths[*][*].parameters[*]"
    then:
      field: description
      function: defined