Browserbase · API Governance Rules

Browserbase API Rules

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

10 Rules error 2 warn 5 info 3
View Rules File View on GitHub

Rule Categories

browserbase

Rules

warn
browserbase-versioned-paths
All Browserbase API paths must be served under /v1/ or be a top-level resource that the server already prefixes.
$.paths[*]~
warn
browserbase-operation-id-camel-case
Browserbase operationIds use camelCase (e.g., createSession, getSession).
$.paths[*][get,post,put,patch,delete].operationId
error
browserbase-operation-id-required
All Browserbase operations must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
browserbase-tags-required
All Browserbase operations must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
error
browserbase-auth-defined
Browserbase API must define the X-BB-API-Key apiKey security scheme.
$.components.securitySchemes
warn
browserbase-success-response-defined
Browserbase operations must define a 2xx success response.
$.paths[*][get,post,put,patch,delete].responses
info
browserbase-summary-title-case
Browserbase operation summaries should use Title Case.
$.paths[*][get,post,put,patch,delete].summary
info
browserbase-info-contact
API info should include a contact block.
$.info
warn
browserbase-info-description
API info must include a description.
$.info
info
browserbase-tag-title-case
OpenAPI tags should use Title Case for consistency across Browserbase resources.
$.tags[*].name

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  browserbase-versioned-paths:
    description: All Browserbase API paths must be served under /v1/ or be a top-level resource that the server already prefixes.
    message: "Path '{{property}}' should be a top-level resource (e.g. /sessions, /contexts) — the /v1 prefix is provided by the server URL."
    given: "$.paths[*]~"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^/[a-z][a-zA-Z0-9-]*(/.*)?$"

  browserbase-operation-id-camel-case:
    description: Browserbase operationIds use camelCase (e.g., createSession, getSession).
    message: "operationId '{{value}}' should use camelCase"
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  browserbase-operation-id-required:
    description: All Browserbase operations must have an operationId.
    message: "Operation at {{path}} is missing operationId"
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: error
    then:
      field: operationId
      function: truthy

  browserbase-tags-required:
    description: All Browserbase operations must declare at least one tag.
    message: "Operation '{{path}}' must include at least one tag"
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: warn
    then:
      field: tags
      function: truthy

  browserbase-auth-defined:
    description: Browserbase API must define the X-BB-API-Key apiKey security scheme.
    message: "API must define an apiKey security scheme using header X-BB-API-Key"
    given: "$.components.securitySchemes"
    severity: error
    then:
      function: truthy

  browserbase-success-response-defined:
    description: Browserbase operations must define a 2xx success response.
    message: "Operation '{{path}}' must define a 200 or 201 success response"
    given: "$.paths[*][get,post,put,patch,delete].responses"
    severity: warn
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ["200"]
            - required: ["201"]
            - required: ["204"]

  browserbase-summary-title-case:
    description: Browserbase operation summaries should use Title Case.
    message: "Summary '{{value}}' should use Title Case"
    given: "$.paths[*][get,post,put,patch,delete].summary"
    severity: info
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"

  browserbase-info-contact:
    description: API info should include a contact block.
    message: "info.contact should be set so consumers can reach the API team"
    given: "$.info"
    severity: info
    then:
      field: contact
      function: truthy

  browserbase-info-description:
    description: API info must include a description.
    message: "info.description must be set"
    given: "$.info"
    severity: warn
    then:
      field: description
      function: truthy

  browserbase-tag-title-case:
    description: OpenAPI tags should use Title Case for consistency across Browserbase resources.
    message: "Tag '{{value}}' should use Title Case"
    given: "$.tags[*].name"
    severity: info
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"