BigCommerce · API Governance Rules

BigCommerce API Rules

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

31 Rules error 7 warn 23 info 1
View Rules File View on GitHub

Rule Categories

bigcommerce error no path query schema servers

Rules

error
bigcommerce-info-title-prefix
API title must start with "BigCommerce"
$.info.title
error
bigcommerce-info-version-present
API info must have a version field
$.info
warn
bigcommerce-info-contact-present
API info must include contact details
$.info
warn
bigcommerce-info-description-present
API info must have a description
$.info
error
bigcommerce-operation-summary-prefix
Operation summaries must start with "BigCommerce"
$.paths[*][*].summary
warn
bigcommerce-operation-id-camel-case
Operation IDs must be camelCase
$.paths[*][*].operationId
warn
bigcommerce-operation-tags-present
Every operation must have at least one tag
$.paths[*][*]
warn
bigcommerce-operation-description-present
Every operation must have a description
$.paths[*][*]
warn
bigcommerce-path-kebab-case
Path segments must use kebab-case
$.paths
error
bigcommerce-response-200-present
Every operation must define a success response
$.paths[*][*].responses
warn
bigcommerce-response-error-present
Operations must define error responses
$.paths[*][post,put,patch,delete].responses
warn
bigcommerce-schema-title-present
All schemas must have a title
$.components.schemas[*]
warn
bigcommerce-schema-description-present
All schemas must have a description
$.components.schemas[*]
warn
bigcommerce-schema-properties-described
Schema properties must have descriptions
$.components.schemas[*].properties[*]
error
bigcommerce-security-scheme-present
API must define at least one security scheme
$.components
warn
bigcommerce-operation-security-present
Mutating operations must declare security
$.paths[*][post,put,patch,delete]
warn
bigcommerce-tags-defined
All tags used in operations must be defined at top level
$.tags
warn
bigcommerce-tag-description-present
Top-level tags must have a description
$.tags[*]
error
bigcommerce-servers-present
API must define servers
$
error
bigcommerce-server-url-https
Server URLs must use HTTPS
$.servers[*].url
warn
bigcommerce-operation-examples-present
Responses with content should include examples
$.paths[*][*].responses[*].content[*]
warn
bigcommerce-microcks-operation-present
Every operation must include x-microcks-operation extension
$.paths[*][*]
warn
bigcommerce-store-hash-variable
Server URLs should use store hash variable
$.servers[*].url
warn
bigcommerce-license-present
API info must include license
$.info
warn
servers-expected-domain
Server URLs should be on the bigcommerce.com domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
info
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (SaveError) should be defined for error payloads.
$.components.schemas
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# bigcommerce — 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: 48/48 servers on bigcommerce.com
#   - path-params-casing: snake @ 81% (n=392)
#   - query-params-casing: snake @ 71% (n=772)
#   - operationid-casing: camel @ 100% (n=547)
#   - schema-names-casing: pascal @ 55% (n=1062)
#   - schema-properties-casing: snake @ 92% (n=3329)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: SaveError
#   - pagination params observed: ['limit', 'page']
#   - merge: kept 24 existing, added 7 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  bigcommerce-info-title-prefix:
    description: API title must start with "BigCommerce"
    message: 'Info title must start with "BigCommerce": {{value}}'
    severity: error
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^BigCommerce
  bigcommerce-info-version-present:
    description: API info must have a version field
    message: Info object must include a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  bigcommerce-info-contact-present:
    description: API info must include contact details
    message: Info object must include contact
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  bigcommerce-info-description-present:
    description: API info must have a description
    message: Info must include description
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  bigcommerce-operation-summary-prefix:
    description: Operation summaries must start with "BigCommerce"
    message: 'Operation summary must start with "BigCommerce": {{value}}'
    severity: error
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: ^BigCommerce
  bigcommerce-operation-id-camel-case:
    description: Operation IDs must be camelCase
    message: 'OperationId must be camelCase: {{value}}'
    severity: warn
    given: $.paths[*][*].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  bigcommerce-operation-tags-present:
    description: Every operation must have at least one tag
    message: Operations must include tags
    severity: warn
    given: $.paths[*][*]
    then:
      field: tags
      function: truthy
  bigcommerce-operation-description-present:
    description: Every operation must have a description
    message: Operations must include description
    severity: warn
    given: $.paths[*][*]
    then:
      field: description
      function: truthy
  bigcommerce-path-kebab-case:
    description: Path segments must use kebab-case
    message: 'Path segments must be kebab-case: {{value}}'
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9-{}._]*)+$
  bigcommerce-response-200-present:
    description: Every operation must define a success response
    message: Operations must include a 200 or 201 response
    severity: error
    given: $.paths[*][*].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
  bigcommerce-response-error-present:
    description: Operations must define error responses
    message: Operations should define 4xx error responses
    severity: warn
    given: $.paths[*][post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
          - required:
            - '400'
          - required:
            - '404'
          - required:
            - '422'
  bigcommerce-schema-title-present:
    description: All schemas must have a title
    message: Schemas must include title
    severity: warn
    given: $.components.schemas[*]
    then:
      field: title
      function: truthy
  bigcommerce-schema-description-present:
    description: All schemas must have a description
    message: Schemas must include description
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  bigcommerce-schema-properties-described:
    description: Schema properties must have descriptions
    message: Schema properties must include description
    severity: warn
    given: $.components.schemas[*].properties[*]
    then:
      field: description
      function: truthy
  bigcommerce-security-scheme-present:
    description: API must define at least one security scheme
    message: Components must include securitySchemes
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  bigcommerce-operation-security-present:
    description: Mutating operations must declare security
    message: POST/PUT/PATCH/DELETE operations must include security
    severity: warn
    given: $.paths[*][post,put,patch,delete]
    then:
      field: security
      function: truthy
  bigcommerce-tags-defined:
    description: All tags used in operations must be defined at top level
    message: Tags must be defined in the global tags section
    severity: warn
    given: $.tags
    then:
      function: truthy
  bigcommerce-tag-description-present:
    description: Top-level tags must have a description
    message: Tags must include a description
    severity: warn
    given: $.tags[*]
    then:
      field: description
      function: truthy
  bigcommerce-servers-present:
    description: API must define servers
    message: Servers array must be present and non-empty
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  bigcommerce-server-url-https:
    description: Server URLs must use HTTPS
    message: 'Server URL must use HTTPS: {{value}}'
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  bigcommerce-operation-examples-present:
    description: Responses with content should include examples
    message: Response content should include examples
    severity: warn
    given: $.paths[*][*].responses[*].content[*]
    then:
      field: examples
      function: truthy
  bigcommerce-microcks-operation-present:
    description: Every operation must include x-microcks-operation extension
    message: Operations must include x-microcks-operation
    severity: warn
    given: $.paths[*][*]
    then:
      field: x-microcks-operation
      function: truthy
  bigcommerce-store-hash-variable:
    description: Server URLs should use store hash variable
    message: Server URL should include store_hash variable
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: \{store_hash\}
  bigcommerce-license-present:
    description: API info must include license
    message: Info must include license
    severity: warn
    given: $.info
    then:
      field: license
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the bigcommerce.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: bigcommerce\.com
  path-params-casing:
    description: Path parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: snake
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  error-schema-defined:
    description: A shared error schema (SaveError) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: SaveError
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy