Sendbird · API Governance Rules

Sendbird API Rules

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

9 Rules error 2 warn 6 info 1
View Rules File View on GitHub

Rule Categories

sendbird

Rules

warn
sendbird-summary-title-case
Operation summaries must use Title Case.
$.paths[*][*].summary
warn
sendbird-api-token-auth
All operations must use Api-Token authentication.
$.paths[*][*]
error
sendbird-server-https
All server URLs must use HTTPS.
$.servers[*].url
warn
sendbird-operationid-camelcase
OperationId must be camelCase.
$.paths[*][*].operationId
error
sendbird-response-200-defined
Operations must have a 200 response.
$.paths[*][get,post,put,patch].responses
warn
sendbird-tags-required
Operations must include at least one tag.
$.paths[*][*].tags
warn
sendbird-error-schema
API must define an Error schema in components.
$.components.schemas
warn
sendbird-info-contact
API info must include contact information.
$.info
info
sendbird-paths-snake-case-query-params
Query parameters should use snake_case.
$.paths[*][*].parameters[?(@.in == 'query')].name

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  sendbird-summary-title-case:
    description: Operation summaries must use Title Case.
    message: "Summary '{{value}}' must use Title Case."
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9\\s]*$"

  sendbird-api-token-auth:
    description: All operations must use Api-Token authentication.
    message: "Operation must define security with apiTokenAuth."
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: security
      function: defined

  sendbird-server-https:
    description: All server URLs must use HTTPS.
    message: "Server URL must use HTTPS."
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  sendbird-operationid-camelcase:
    description: OperationId must be camelCase.
    message: "OperationId '{{value}}' must be camelCase."
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  sendbird-response-200-defined:
    description: Operations must have a 200 response.
    message: "Operation must define a 200 response."
    severity: error
    given: "$.paths[*][get,post,put,patch].responses"
    then:
      field: "200"
      function: defined

  sendbird-tags-required:
    description: Operations must include at least one tag.
    message: "Operation must have at least one tag."
    severity: warn
    given: "$.paths[*][*].tags"
    then:
      function: length
      functionOptions:
        min: 1

  sendbird-error-schema:
    description: API must define an Error schema in components.
    message: "components.schemas must include an Error schema."
    severity: warn
    given: "$.components.schemas"
    then:
      field: Error
      function: defined

  sendbird-info-contact:
    description: API info must include contact information.
    message: "API info.contact must be defined."
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: defined

  sendbird-paths-snake-case-query-params:
    description: Query parameters should use snake_case.
    message: "Query parameter '{{value}}' should use snake_case."
    severity: info
    given: "$.paths[*][*].parameters[?(@.in == 'query')].name"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-z0-9_]*$"