University of Bonn · API Governance Rules

University of Bonn API Rules

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

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

Rule Categories

bonndata

Rules

warn
bonndata-info-title
API title should reference bonndata / Dataverse.
$.info.title
error
bonndata-server-base
Servers should point at the bonndata Native API base under /api.
$.servers[*].url
warn
bonndata-response-envelope
JSON responses follow the Dataverse envelope with a top-level "status" property (OK/ERROR).
$.components.schemas.ApiEnvelope.properties
warn
bonndata-search-paginated
The /search operation must expose per_page and start pagination params.
$.paths['/search'].get.parameters[*].name
warn
bonndata-operation-id
Every operation should carry an operationId (matches upstream Dataverse).
$.paths[*][get,post,put,delete]
info
bonndata-persistent-id
Datasets are addressable by DOI persistent identifier; the dataset retrieval operation should document the persistentId query parameter.
$.paths['/datasets/{id}'].get.parameters[*].name

Spectral Ruleset

Raw ↑
extends: []
formats:
  - oas3
documentationUrl: https://guides.dataverse.org/en/latest/api/native-api.html
rules:
  bonndata-info-title:
    description: API title should reference bonndata / Dataverse.
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: "(?i)(dataverse|bonndata)"

  bonndata-server-base:
    description: Servers should point at the bonndata Native API base under /api.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "bonndata\\.uni-bonn\\.de/api"

  bonndata-response-envelope:
    description: >-
      JSON responses follow the Dataverse envelope with a top-level "status"
      property (OK/ERROR).
    severity: warn
    given: $.components.schemas.ApiEnvelope.properties
    then:
      field: status
      function: truthy

  bonndata-search-paginated:
    description: The /search operation must expose per_page and start pagination params.
    severity: warn
    given: $.paths['/search'].get.parameters[*].name
    then:
      function: pattern
      functionOptions:
        match: "(q|type|per_page|start|sort|order|fq|subtree|show_relevance|show_facets|show_entity_ids|show_type_counts|geo_point|geo_radius|metadata_fields|query_entities|search_service|show_api_urls)"

  bonndata-operation-id:
    description: Every operation should carry an operationId (matches upstream Dataverse).
    severity: warn
    given: $.paths[*][get,post,put,delete]
    then:
      field: operationId
      function: truthy

  bonndata-persistent-id:
    description: >-
      Datasets are addressable by DOI persistent identifier; the dataset
      retrieval operation should document the persistentId query parameter.
    severity: info
    given: $.paths['/datasets/{id}'].get.parameters[*].name
    then:
      function: pattern
      functionOptions:
        match: "(id|persistentId|returnOwners)"