Macquarie University · API Governance Rules

Macquarie University API Rules

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

6 Rules error 1 warn 4 info 1
View Rules File View on GitHub

Rule Categories

macquarie

Rules

warn
macquarie-info-title
API info.title must reference Figshare / Macquarie RDR.
$.info.title
error
macquarie-server-https
All servers must use the public Figshare HTTPS base URL.
$.servers[*].url
warn
macquarie-oauth2-security-scheme
Authenticated operations rely on the OAuth2 security scheme.
$.components.securitySchemes
warn
macquarie-article-doi-required
The Article object must declare a DOI field (Macquarie uses DOI prefix 10.25949).
$.components.schemas.Article.required
warn
macquarie-operation-tags
Every operation should be tagged for discoverability.
$.paths[*][get,post,put,delete,patch]
info
macquarie-operation-description
Operations should carry a human-readable description or summary.
$.paths[*][get,post,put,delete,patch]

Spectral Ruleset

Raw ↑
---
# Spectral ruleset for the Macquarie University Research Data Repository
# (Figshare API v2). Encodes patterns observed in the upstream Figshare
# OpenAPI 3.0.3 description as saved in openapi/macquarie-rdr-figshare.yaml.
formats:
  - oas3
extends:
  - spectral:oas
rules:
  macquarie-info-title:
    description: API info.title must reference Figshare / Macquarie RDR.
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: "(?i)figshare"

  macquarie-server-https:
    description: All servers must use the public Figshare HTTPS base URL.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://api\\.figshare\\.com/v2"

  macquarie-oauth2-security-scheme:
    description: Authenticated operations rely on the OAuth2 security scheme.
    severity: warn
    given: $.components.securitySchemes
    then:
      field: OAuth2
      function: truthy

  macquarie-article-doi-required:
    description: The Article object must declare a DOI field (Macquarie uses DOI prefix 10.25949).
    severity: warn
    given: $.components.schemas.Article.required
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            const: doi

  macquarie-operation-tags:
    description: Every operation should be tagged for discoverability.
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: truthy

  macquarie-operation-description:
    description: Operations should carry a human-readable description or summary.
    severity: info
    given: $.paths[*][get,post,put,delete,patch]
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: [description]
            - required: [summary]