University of York · API Governance Rules

University of York API Rules

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

7 Rules error 3 warn 4
View Rules File View on GitHub

Rule Categories

oai

Rules

error
oai-info-title-present
API must declare a title.
$.info
error
oai-info-version-present
API must declare a version.
$.info
warn
oai-contact-email-present
Repository contact email should be published (OAI-PMH adminEmail convention).
$.info.contact
warn
oai-single-endpoint
OAI-PMH repositories expose a single base URL; only the /oai2 path is expected.
$.paths
error
oai-verb-parameter-required
Every operation must require the OAI-PMH 'verb' query parameter.
$.paths[*].get.parameters[?(@.name=='verb')]
warn
oai-verb-enum-complete
The verb parameter should enumerate the six OAI-PMH 2.0 verbs.
$.paths[*].get.parameters[?(@.name=='verb')].schema
warn
oai-xml-response-media-type
OAI-PMH responses are XML; the 200 response should declare application/xml.
$.paths[*].get.responses['200'].content

Spectral Ruleset

Raw ↑
extends: []
formats:
  - oas3
documentationUrl: https://eprints.whiterose.ac.uk/about.html
rules:
  oai-info-title-present:
    description: API must declare a title.
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  oai-info-version-present:
    description: API must declare a version.
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  oai-contact-email-present:
    description: Repository contact email should be published (OAI-PMH adminEmail convention).
    severity: warn
    given: $.info.contact
    then:
      field: email
      function: truthy
  oai-single-endpoint:
    description: OAI-PMH repositories expose a single base URL; only the /oai2 path is expected.
    severity: warn
    given: $.paths
    then:
      function: length
      functionOptions:
        max: 1
  oai-verb-parameter-required:
    description: Every operation must require the OAI-PMH 'verb' query parameter.
    severity: error
    given: $.paths[*].get.parameters[?(@.name=='verb')]
    then:
      field: required
      function: truthy
  oai-verb-enum-complete:
    description: The verb parameter should enumerate the six OAI-PMH 2.0 verbs.
    severity: warn
    given: $.paths[*].get.parameters[?(@.name=='verb')].schema
    then:
      field: enum
      function: truthy
  oai-xml-response-media-type:
    description: OAI-PMH responses are XML; the 200 response should declare application/xml.
    severity: warn
    given: $.paths[*].get.responses['200'].content
    then:
      field: application/xml
      function: truthy