University of British Columbia · API Governance Rules

University of British Columbia API Rules

Spectral linting rules defining API design standards and conventions for University of British Columbia.

5 Rules error 1 warn 3 info 1
View Rules File View on GitHub

Rule Categories

ubc

Rules

warn
ubc-info-version-present
API info object should declare a version (Dataverse release the spec was generated from).
$.info
error
ubc-server-https
Server URLs should use HTTPS for the public Abacus endpoint.
$.servers[*].url
warn
ubc-paths-api-v1-prefix
Dataverse REST paths are versioned under /api/v1/.
$.paths
warn
ubc-operation-id-present
Every operation should carry an operationId for client generation.
$.paths[*][get,post,put,delete,patch]
info
ubc-dataset-uses-persistent-id
Dataset access patterns should support persistentId (DOI/Handle) addressing.
$.paths[?(@property.match(/persistentId|globalId/i))]

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, off]]
formats: [oas3]
documentationUrl: https://abacus.library.ubc.ca/
rules:
  ubc-info-version-present:
    description: API info object should declare a version (Dataverse release the spec was generated from).
    severity: warn
    given: $.info
    then:
      field: version
      function: truthy

  ubc-server-https:
    description: Server URLs should use HTTPS for the public Abacus endpoint.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: '^https://'

  ubc-paths-api-v1-prefix:
    description: Dataverse REST paths are versioned under /api/v1/.
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: '/api/v1/'

  ubc-operation-id-present:
    description: Every operation should carry an operationId for client generation.
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: operationId
      function: truthy

  ubc-dataset-uses-persistent-id:
    description: Dataset access patterns should support persistentId (DOI/Handle) addressing.
    severity: info
    given: $.paths[?(@property.match(/persistentId|globalId/i))]
    then:
      function: defined