Bright Data · API Governance Rules

Bright Data API Rules

Spectral linting rules defining API design standards and conventions for Bright Data.

8 Rules error 3 warn 5
View Rules File View on GitHub

Rule Categories

bright

Rules

error
bright-data-info-contact
Bright Data specs must publish contact info.
$.info.contact
warn
bright-data-bearer-auth
Bright Data REST APIs authenticate with a Bearer API token.
$.components.securitySchemes
warn
bright-data-server-api-host
Bright Data production server MUST be https://api.brightdata.com (Proxy Manager uses localhost:22999).
$.servers[*].url
warn
bright-data-operation-summary-title-case
Operation summaries should use Title Case.
$.paths[*][get,post,put,delete,patch].summary
error
bright-data-operation-tags-required
Every Bright Data operation must declare at least one tag.
$.paths[*][get,post,put,delete,patch]
warn
bright-data-snapshot-id-naming
Snapshot identifiers MUST use snake_case `snapshot_id`.
$.paths[?(@property ~~ /.*snapshot.*/)][*].parameters[?(@.in == 'path')].name
error
bright-data-no-trailing-slash
Bright Data paths must not include trailing slashes.
$.paths
warn
bright-data-error-response
Mutating operations should document a 4xx response.
$.paths[*][post,put,delete,patch].responses

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]
documentationUrl: https://docs.brightdata.com
functions: []
rules:
  bright-data-info-contact:
    description: Bright Data specs must publish contact info.
    given: $.info.contact
    severity: error
    then:
      - field: name
        function: truthy
      - field: url
        function: truthy
  bright-data-bearer-auth:
    description: Bright Data REST APIs authenticate with a Bearer API token.
    given: $.components.securitySchemes
    severity: warn
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  bright-data-server-api-host:
    description: Bright Data production server MUST be https://api.brightdata.com (Proxy Manager uses localhost:22999).
    given: $.servers[*].url
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^(https://api\.brightdata\.com|https://brd\.superproxy\.io|wss://brd\.superproxy\.io|http://localhost:22999)'
  bright-data-operation-summary-title-case:
    description: Operation summaries should use Title Case.
    given: $.paths[*][get,post,put,delete,patch].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][A-Za-z0-9]*)( [A-Za-z0-9/()_-]+)*$'
  bright-data-operation-tags-required:
    description: Every Bright Data operation must declare at least one tag.
    given: $.paths[*][get,post,put,delete,patch]
    severity: error
    then:
      field: tags
      function: truthy
  bright-data-snapshot-id-naming:
    description: Snapshot identifiers MUST use snake_case `snapshot_id`.
    given: "$.paths[?(@property ~~ /.*snapshot.*/)][*].parameters[?(@.in == 'path')].name"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^snapshot_id$'
  bright-data-no-trailing-slash:
    description: Bright Data paths must not include trailing slashes.
    given: $.paths
    severity: error
    then:
      function: pattern
      functionOptions:
        match: '^[^/].*[^/]$|^/$|^/[^/]+$|^/.*[^/]$'
        property: '@key'
  bright-data-error-response:
    description: Mutating operations should document a 4xx response.
    given: $.paths[*][post,put,delete,patch].responses
    severity: warn
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            '^4\d\d$': {}
          additionalProperties: true