Backblaze · API Governance Rules

Backblaze API Rules

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

36 Rules error 12 warn 16 info 8
View Rules File View on GitHub

Rule Categories

components error get info no openapi operation parameter paths post request response schema security servers tags

Rules

error
info-title-required
Info must have a title
$.info
warn
info-description-required
Info must have a description
$.info
error
info-version-required
Info must have a version
$.info
info
info-contact-required
Info should have contact information
$.info
error
openapi-version-3
Must use OpenAPI 3.0.x
$
error
servers-defined
Servers must be defined
$
error
servers-https-only
All server URLs must use HTTPS
$.servers[*].url
warn
paths-no-trailing-slash
Paths must not have trailing slashes
$.paths
warn
paths-b2-api-prefix
B2 Native API paths should use /b2api/v{version}/ prefix
$.paths
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-description-required
Every operation must have a description
$.paths[*][get,post,put,patch,delete,head,options]
error
operation-id-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-id-camel-case
OperationIds should use camelCase
$.paths[*][get,post,put,patch,delete,head,options].operationId
warn
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete,head,options]
info
operation-summary-backblaze-prefix
Operation summaries should start with "Backblaze B2"
$.paths[*][get,post,put,patch,delete,head,options].summary
info
tags-global-defined
Global tags array should be defined
$
warn
parameter-description-required
All parameters must have descriptions
$.paths[*][get,post,put,patch,delete,head,options].parameters[*]
error
parameter-schema-required
All parameters must have a schema
$.paths[*][get,post,put,patch,delete,head,options].parameters[*]
info
request-body-description
Request bodies should have descriptions
$.paths[*][post,put,patch].requestBody
error
response-success-required
Every operation must have at least one 2xx response
$.paths[*][get,post,put,patch,delete]
error
response-description-required
Every response must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-401-defined
Operations with auth should define 401 response
$.paths[*][post,get]
warn
schema-type-defined
All schemas should have a type
$.components.schemas[*]
info
schema-title-defined
All component schemas should have a title
$.components.schemas[*]
info
schema-description-defined
All component schemas should have a description
$.components.schemas[*]
error
security-schemes-defined
Security schemes must be defined in components
$.components
warn
security-global-defined
Global security should be defined
$
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
warn
post-b2-operations-have-request-body
POST operations should have a request body
$.paths[*].post
warn
no-empty-descriptions
Descriptions must not be empty strings
$..description
info
components-schemas-present
Spec should define reusable schemas in components
$.components
warn
servers-expected-domain
Server URLs should be on the backblazeb2.com domain.
$.servers[*].url
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be camelCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (ErrorResponse) should be defined for error payloads.
$.components.schemas
warn
operation-documents-401
Operations should document a 401 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
# backblaze — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on backblazeb2.com
#   - operationid-casing: camel @ 100% (n=27)
#   - schema-names-casing: pascal @ 100% (n=43)
#   - schema-properties-casing: camel @ 84% (n=145)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: ErrorResponse
#   - operation-documents-401: 100% adherence
#   - merge: kept 31 existing, added 5 measured, upgraded 0
#   - added: servers-expected-domain, schema-names-casing, schema-properties-casing, error-schema-defined, operation-documents-401
extends:
  - spectral:oas
rules:
  info-title-required:
    description: Info must have a title
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-description-required:
    description: Info must have a description
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: Info must have a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  info-contact-required:
    description: Info should have contact information
    severity: info
    given: $.info
    then:
      field: contact
      function: truthy
  openapi-version-3:
    description: Must use OpenAPI 3.0.x
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.0\.
  servers-defined:
    description: Servers must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    description: All server URLs must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  paths-b2-api-prefix:
    description: B2 Native API paths should use /b2api/v{version}/ prefix
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: ^/b2api/
  operation-summary-required:
    description: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: summary
      function: truthy
  operation-description-required:
    description: Every operation must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: description
      function: truthy
  operation-id-required:
    description: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: operationId
      function: truthy
  operation-id-camel-case:
    description: OperationIds should use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  operation-tags-required:
    description: Every operation must have at least one tag
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: tags
      function: truthy
  operation-summary-backblaze-prefix:
    description: Operation summaries should start with "Backblaze B2"
    severity: info
    given: $.paths[*][get,post,put,patch,delete,head,options].summary
    then:
      function: pattern
      functionOptions:
        match: ^Backblaze
  tags-global-defined:
    description: Global tags array should be defined
    severity: info
    given: $
    then:
      field: tags
      function: truthy
  parameter-description-required:
    description: All parameters must have descriptions
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].parameters[*]
    then:
      field: description
      function: truthy
  parameter-schema-required:
    description: All parameters must have a schema
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options].parameters[*]
    then:
      field: schema
      function: truthy
  request-body-description:
    description: Request bodies should have descriptions
    severity: info
    given: $.paths[*][post,put,patch].requestBody
    then:
      field: description
      function: truthy
  response-success-required:
    description: Every operation must have at least one 2xx response
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: responses
      function: truthy
  response-description-required:
    description: Every response must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy
  response-401-defined:
    description: Operations with auth should define 401 response
    severity: warn
    given: $.paths[*][post,get]
    then:
      field: responses.401
      function: truthy
  schema-type-defined:
    description: All schemas should have a type
    severity: warn
    given: $.components.schemas[*]
    then:
      field: type
      function: truthy
  schema-title-defined:
    description: All component schemas should have a title
    severity: info
    given: $.components.schemas[*]
    then:
      field: title
      function: truthy
  schema-description-defined:
    description: All component schemas should have a description
    severity: info
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  security-schemes-defined:
    description: Security schemes must be defined in components
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  security-global-defined:
    description: Global security should be defined
    severity: warn
    given: $
    then:
      field: security
      function: truthy
  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  post-b2-operations-have-request-body:
    description: POST operations should have a request body
    severity: warn
    given: $.paths[*].post
    then:
      field: requestBody
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings
    severity: warn
    given: $..description
    then:
      function: truthy
  components-schemas-present:
    description: Spec should define reusable schemas in components
    severity: info
    given: $.components
    then:
      field: schemas
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the backblazeb2.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: backblazeb2\.com
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be camelCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: camel
  error-schema-defined:
    description: A shared error schema (ErrorResponse) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: ErrorResponse
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy