University of North Carolina at Chapel Hill API Rules

Spectral linting rules defining API design standards and conventions for University of North Carolina at Chapel Hill.

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

Rule Categories

unc

Rules

warn
unc-dataverse-info-title
API title should identify the Dataverse API.
$.info.title
info
unc-dataverse-server-host
A server pointing at the UNC Dataverse instance should be declared.
$.servers[*].url
warn
unc-dataverse-operation-tags
Every operation should carry at least one tag (Dataverse groups operations by tag).
$.paths[*][get,post,put,delete,patch]
info
unc-dataverse-api-key-auth
Dataverse uses an X-Dataverse-key API token for authenticated operations.
$.components.securitySchemes
hint
unc-dataverse-paths-lowercase
Paths should be lower-case kebab/slash style as used throughout the Dataverse API.
$.paths

Spectral Ruleset

Raw ↑
---
# Spectral ruleset encoding observed patterns of the UNC Dataverse Native REST API (Dataverse 6.8).
# Derived from the live /openapi document at https://dataverse.unc.edu/openapi
formats:
  - oas3
rules:
  unc-dataverse-info-title:
    description: API title should identify the Dataverse API.
    given: $.info.title
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "Dataverse"

  unc-dataverse-server-host:
    description: A server pointing at the UNC Dataverse instance should be declared.
    given: $.servers[*].url
    severity: info
    then:
      function: pattern
      functionOptions:
        match: "dataverse\\.unc\\.edu"

  unc-dataverse-operation-tags:
    description: Every operation should carry at least one tag (Dataverse groups operations by tag).
    given: $.paths[*][get,post,put,delete,patch]
    severity: warn
    then:
      field: tags
      function: truthy

  unc-dataverse-api-key-auth:
    description: Dataverse uses an X-Dataverse-key API token for authenticated operations.
    given: $.components.securitySchemes
    severity: info
    then:
      function: defined

  unc-dataverse-paths-lowercase:
    description: Paths should be lower-case kebab/slash style as used throughout the Dataverse API.
    given: $.paths
    severity: hint
    then:
      function: alphabetical