University of Padua · API Governance Rules

University of Padua API Rules

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

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

Rule Categories

padua

Rules

warn
padua-info-license
PHAIDRA API info should carry a license (the published spec declares Apache 2.0).
$.info
error
padua-servers-https
Servers must use the HTTPS PHAIDRA endpoint.
$.servers[*].url
info
padua-object-paths-use-pid
Object-scoped paths are addressed by a persistent identifier named {pid}.
$.paths[?(@property.match(/^\/object\/\{/))]~
error
padua-operations-have-responses
Every operation must define at least one response.
$.paths[*][get,post,put,delete,patch].responses
warn
padua-operations-tagged
Operations should be grouped with one of the PHAIDRA tags.
$.paths[*][get,post,put,delete,patch]

Spectral Ruleset

Raw ↑
formats:
  - oas3

extends:
  - spectral:oas

rules:

  padua-info-license:
    description: PHAIDRA API info should carry a license (the published spec declares Apache 2.0).
    given: $.info
    severity: warn
    then:
      field: license
      function: truthy

  padua-servers-https:
    description: Servers must use the HTTPS PHAIDRA endpoint.
    given: $.servers[*].url
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  padua-object-paths-use-pid:
    description: Object-scoped paths are addressed by a persistent identifier named {pid}.
    given: $.paths[?(@property.match(/^\/object\/\{/))]~
    severity: info
    then:
      function: pattern
      functionOptions:
        match: "\\{pid\\}"

  padua-operations-have-responses:
    description: Every operation must define at least one response.
    given: $.paths[*][get,post,put,delete,patch].responses
    severity: error
    then:
      function: truthy

  padua-operations-tagged:
    description: Operations should be grouped with one of the PHAIDRA tags.
    given: $.paths[*][get,post,put,delete,patch]
    severity: warn
    then:
      field: tags
      function: truthy