Stockholm University · API Governance Rules

Stockholm University API Rules

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

6 Rules error 1 warn 3 info 2
View Rules File View on GitHub

Rule Categories

stockholm

Rules

warn
stockholm-info-contact
API info object should declare a contact, as the Figshare-backed Stockholm research data API does.
$.info
warn
stockholm-info-license
API info object should declare a license (Figshare publishes under Apache 2.0).
$.info
error
stockholm-server-https
Servers must use HTTPS; the Figshare API base is https://api.figshare.com/v2.
$.servers[*].url
info
stockholm-article-has-doi
Article-like response schemas should expose a doi property for persistent citation.
$.components.schemas[?(@property.match(/^Article/))].properties
info
stockholm-author-orcid
Author schemas should expose orcid_id to support researcher identity resolution.
$.components.schemas.Author.properties
warn
stockholm-operation-summary
Every operation should have a summary describing its purpose.
$.paths[*][get,post,put,delete,patch]

Spectral Ruleset

Raw ↑
formats:
  - oas3

rules:

  stockholm-info-contact:
    description: API info object should declare a contact, as the Figshare-backed Stockholm research data API does.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy

  stockholm-info-license:
    description: API info object should declare a license (Figshare publishes under Apache 2.0).
    severity: warn
    given: $.info
    then:
      field: license
      function: truthy

  stockholm-server-https:
    description: Servers must use HTTPS; the Figshare API base is https://api.figshare.com/v2.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  stockholm-article-has-doi:
    description: Article-like response schemas should expose a doi property for persistent citation.
    severity: info
    given: $.components.schemas[?(@property.match(/^Article/))].properties
    then:
      field: doi
      function: defined

  stockholm-author-orcid:
    description: Author schemas should expose orcid_id to support researcher identity resolution.
    severity: info
    given: $.components.schemas.Author.properties
    then:
      field: orcid_id
      function: defined

  stockholm-operation-summary:
    description: Every operation should have a summary describing its purpose.
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: summary
      function: truthy