University of Chile · API Governance Rules

University of Chile API Rules

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

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

Rule Categories

uchile

Rules

error
uchile-info-title
The OpenAPI document should declare an info.title.
$.info
error
uchile-info-version
The OpenAPI document should declare an info.version.
$.info
warn
uchile-servers-https
Public Dataverse server URLs should use HTTPS, not internal hostnames.
$.servers[*].url
info
uchile-paths-versioned
Dataverse native API paths are versioned under /api/v1.
$.paths[*]~
warn
uchile-operation-id
Every operation should carry an operationId for tooling and SDK generation.
$.paths[*][get,post,put,delete,patch]
warn
uchile-get-responses
GET operations should document at least one response.
$.paths[*].get

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, off]]
formats: [oas3]
documentationUrl: https://guides.dataverse.org/en/latest/api/
rules:
  uchile-info-title:
    description: The OpenAPI document should declare an info.title.
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  uchile-info-version:
    description: The OpenAPI document should declare an info.version.
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  uchile-servers-https:
    description: Public Dataverse server URLs should use HTTPS, not internal hostnames.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://"
  uchile-paths-versioned:
    description: Dataverse native API paths are versioned under /api/v1.
    severity: info
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: "^/api/(v1/|info|search|access|dataverses|datasets|files)"
  uchile-operation-id:
    description: Every operation should carry an operationId for tooling and SDK generation.
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: operationId
      function: truthy
  uchile-get-responses:
    description: GET operations should document at least one response.
    severity: warn
    given: $.paths[*].get
    then:
      field: responses
      function: truthy