University of the Witwatersrand · API Governance Rules

University of the Witwatersrand API Rules

Spectral linting rules defining API design standards and conventions for University of the Witwatersrand.

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

Rule Categories

wits

Rules

warn
wits-info-contact
API info should carry a contact for the Wits library/open scholarship team.
$.info
warn
wits-info-license
Standards-based university APIs should declare a license.
$.info
error
wits-server-https
All servers must use HTTPS.
$.servers[*].url
warn
wits-operation-id
Every operation must declare an operationId.
$.paths[*][get,post,put,delete,patch]
warn
wits-operation-summary
Every operation must have a summary.
$.paths[*][get,post,put,delete,patch]
warn
wits-200-response
Read operations should document a 200 response.
$.paths[*].get.responses
info
wits-tags-defined
Operations should be grouped with tags for navigability.
$.paths[*][get,post,put,delete,patch]

Spectral Ruleset

Raw ↑
---
# Spectral ruleset encoding patterns observed across the University of the
# Witwatersrand machine-readable interfaces (DSpace 9.2 REST, OAI-PMH 2.0,
# Figshare v2). Apply with: spectral lint -r this-file.yml <openapi.yaml>
formats:
  - oas3
rules:
  wits-info-contact:
    description: API info should carry a contact for the Wits library/open scholarship team.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  wits-info-license:
    description: Standards-based university APIs should declare a license.
    severity: warn
    given: $.info
    then:
      field: license
      function: truthy
  wits-server-https:
    description: All servers must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://"
  wits-operation-id:
    description: Every operation must declare an operationId.
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: operationId
      function: truthy
  wits-operation-summary:
    description: Every operation must have a summary.
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: summary
      function: truthy
  wits-200-response:
    description: Read operations should document a 200 response.
    severity: warn
    given: $.paths[*].get.responses
    then:
      field: "200"
      function: truthy
  wits-tags-defined:
    description: Operations should be grouped with tags for navigability.
    severity: info
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: truthy