Indian Institute of Science Bangalore · API Governance Rules

Indian Institute of Science Bangalore API Rules

Spectral linting rules defining API design standards and conventions for Indian Institute of Science Bangalore.

6 Rules error 2 warn 4
View Rules File View on GitHub

Rule Categories

iisc

Rules

warn
iisc-info-contact
API info should include a contact.
$.info
error
iisc-server-https
ETD@IISc REST servers must be served over HTTPS.
$.servers[*].url
error
iisc-operation-id
Every operation must declare an operationId.
$.paths[*][get,post,put,delete,patch]
warn
iisc-object-has-uuid
Core DSpace resource schemas (Community, Collection, Item, Bitstream) should expose a uuid property, matching the live API.
$.components.schemas[Community,Collection,Item,Bitstream]
warn
iisc-object-has-type-discriminator
DSpace base object must carry a string "type" discriminator.
$.components.schemas.DSpaceObject.properties.type
warn
iisc-read-only-paths
The public ETD@IISc profile is read-only; only GET operations are expected on documented paths.
$.paths[*]

Spectral Ruleset

Raw ↑
---
# Spectral ruleset encoding patterns observed in the ETD@IISc DSpace 6 REST API.
# These rules express conventions confirmed against the live API: UUID-keyed
# resources, handle identifiers, a discriminating "type" field, and read-only
# JSON responses.
formats:
  - oas3
rules:
  iisc-info-contact:
    description: API info should include a contact.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy

  iisc-server-https:
    description: ETD@IISc REST servers must be served over HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  iisc-operation-id:
    description: Every operation must declare an operationId.
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: operationId
      function: truthy

  iisc-object-has-uuid:
    description: >-
      Core DSpace resource schemas (Community, Collection, Item, Bitstream)
      should expose a uuid property, matching the live API.
    severity: warn
    given: $.components.schemas[Community,Collection,Item,Bitstream]
    then:
      function: defined

  iisc-object-has-type-discriminator:
    description: DSpace base object must carry a string "type" discriminator.
    severity: warn
    given: $.components.schemas.DSpaceObject.properties.type
    then:
      field: type
      function: truthy

  iisc-read-only-paths:
    description: >-
      The public ETD@IISc profile is read-only; only GET operations are
      expected on documented paths.
    severity: warn
    given: $.paths[*]
    then:
      field: post
      function: undefined