Riverside · API Governance Rules

Riverside API Rules

Spectral linting rules defining API design standards and conventions for Riverside.

11 Rules error 3 warn 4 info 4
View Rules File View on GitHub

Rule Categories

riverside

Rules

warn
riverside-operation-has-tag
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
error
riverside-operation-has-summary
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
error
riverside-operation-has-operation-id
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
riverside-api-key-auth
API should use Bearer/API key authentication
$.components.securitySchemes[*]
info
riverside-recording-id-path-param
Recording endpoints should use recording_id as path parameter
$.paths['/api/v1/recordings/{recording_id}'][*].parameters[?(@.in === 'path')]
error
riverside-responses-have-200
GET operations should have a 200 response
$.paths[*].get
warn
riverside-delete-returns-204
DELETE operations should return 204 No Content
$.paths[*].delete
info
riverside-pagination-uses-page
Paginated list endpoints should use page parameter
$.paths[*].get.parameters[?(@.name === 'page')]
info
riverside-schema-has-description
Schema components should have descriptions
$.components.schemas[*]
info
riverside-rate-limit-documented
Operations should document rate limiting in description
$.paths[*][get,post]
warn
riverside-versioned-paths
API paths should include version prefix (v1, v2, v3)
$.paths[*]~

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  # Riverside Business API Conventions

  riverside-operation-has-tag:
    description: All operations must have at least one tag
    message: Operation {{path}} is missing a tag
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  riverside-operation-has-summary:
    description: All operations must have a summary
    message: Operation {{path}} is missing a summary
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  riverside-operation-has-operation-id:
    description: All operations must have an operationId
    message: Operation {{path}} is missing an operationId
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  riverside-api-key-auth:
    description: API should use Bearer/API key authentication
    message: Security scheme should use http bearer or apiKey type
    severity: warn
    given: "$.components.securitySchemes[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            type:
              type: string
              enum:
                - http
                - apiKey

  riverside-recording-id-path-param:
    description: Recording endpoints should use recording_id as path parameter
    message: Recording path parameter should be named recording_id
    severity: info
    given: "$.paths['/api/v1/recordings/{recording_id}'][*].parameters[?(@.in === 'path')]"
    then:
      field: name
      function: pattern
      functionOptions:
        match: "^recording_id$"

  riverside-responses-have-200:
    description: GET operations should have a 200 response
    message: GET operation {{path}} should have a 200 response
    severity: error
    given: "$.paths[*].get"
    then:
      field: responses.200
      function: truthy

  riverside-delete-returns-204:
    description: DELETE operations should return 204 No Content
    message: DELETE operation {{path}} should return 204
    severity: warn
    given: "$.paths[*].delete"
    then:
      field: responses.204
      function: truthy

  riverside-pagination-uses-page:
    description: Paginated list endpoints should use page parameter
    message: List endpoint {{path}} should support pagination with page parameter
    severity: info
    given: "$.paths[*].get.parameters[?(@.name === 'page')]"
    then:
      field: schema.type
      function: pattern
      functionOptions:
        match: "^integer$"

  riverside-schema-has-description:
    description: Schema components should have descriptions
    message: Schema {{path}} is missing a description
    severity: info
    given: "$.components.schemas[*]"
    then:
      field: description
      function: truthy

  riverside-rate-limit-documented:
    description: Operations should document rate limiting in description
    message: Operation {{path}} should describe rate limits
    severity: info
    given: "$.paths[*][get,post]"
    then:
      field: description
      function: truthy

  riverside-versioned-paths:
    description: API paths should include version prefix (v1, v2, v3)
    message: Path {{path}} should include a version prefix
    severity: warn
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^/api/v[0-9]+"