parcelLab · API Governance Rules

parcelLab API Rules

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

7 Rules error 2 warn 5
View Rules File View on GitHub

Rule Categories

parcellab

Rules

warn
parcellab-info-contact
parcelLab specs must point at parcelLab developer support.
$.info.contact
error
parcellab-versioned-paths
Operations live under /v4/ — the current API version.
$.paths.*~
warn
parcellab-operation-id-camel
Operation IDs use camelCase.
$.paths[*][*].operationId
warn
parcellab-summary-title-case
Operation summaries use Title Case.
$.paths[*][*].summary
error
parcellab-auth-token-header
Define the Parcellab-API-Token apiKey security scheme on the Authorization header.
$.components.securitySchemes
warn
parcellab-tag-set
Use the canonical parcelLab tag set.
$.tags[*].name
warn
parcellab-trailing-slash
parcelLab paths end with a trailing slash, matching the published API.
$.paths.*~

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, recommended]]
documentationUrl: https://docs.parcellab.com/docs/developers/getting-started/api-reference
rules:
  parcellab-info-contact:
    description: parcelLab specs must point at parcelLab developer support.
    given: $.info.contact
    severity: warn
    then:
      - field: name
        function: truthy
      - field: url
        function: pattern
        functionOptions:
          match: "^https://docs\\.parcellab\\.com/.*"
  parcellab-versioned-paths:
    description: Operations live under /v4/ — the current API version.
    given: $.paths.*~
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^/v[0-9]+/"
  parcellab-operation-id-camel:
    description: Operation IDs use camelCase.
    given: $.paths[*][*].operationId
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"
  parcellab-summary-title-case:
    description: Operation summaries use Title Case.
    given: $.paths[*][*].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-zA-Z0-9]*)(\\s+[A-Z/][a-zA-Z0-9/]*)*$"
  parcellab-auth-token-header:
    description: Define the Parcellab-API-Token apiKey security scheme on the Authorization header.
    given: $.components.securitySchemes
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  parcellab-tag-set:
    description: Use the canonical parcelLab tag set.
    given: $.tags[*].name
    severity: warn
    then:
      function: enumeration
      functionOptions:
        values:
          - Orders
          - Events
          - Place Info
          - Promise
          - Returns
          - Campaigns
          - Surveys
  parcellab-trailing-slash:
    description: parcelLab paths end with a trailing slash, matching the published API.
    given: $.paths.*~
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: ".*/$"