Shuffle · API Governance Rules

Shuffle API Rules

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

9 Rules error 5 warn 4
View Rules File View on GitHub

Rule Categories

shuffle

Rules

error
shuffle-operation-tags
All operations must have at least one tag
$.paths[*][*]
error
shuffle-operation-summary
All operations must have a summary
$.paths[*][*]
error
shuffle-bearer-auth
API must use Bearer token authentication
$.components.securitySchemes[*]
warn
shuffle-api-response
Standard API responses should include success boolean
$.components.schemas.ApiResponse
warn
shuffle-workflow-id
Workflow operations should use consistent id parameter naming
$.paths['/workflows/{id}'][*].parameters[?(@.name == 'id')]
error
shuffle-response-200
All operations must have a 200 response
$.paths[*][*].responses
warn
shuffle-response-401
Operations should document 401 Unauthorized response
$.paths[*].get.responses
error
shuffle-operation-id
All operations must have an operationId in camelCase
$.paths[*][*]
warn
shuffle-v1-prefix
All API paths should use /api/v1 prefix (reflected in servers)
$.servers[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  shuffle-operation-tags:
    description: All operations must have at least one tag
    message: "Operation must have at least one tag"
    given: "$.paths[*][*]"
    severity: error
    then:
      field: tags
      function: truthy

  shuffle-operation-summary:
    description: All operations must have a summary
    message: "Operation must have a summary"
    given: "$.paths[*][*]"
    severity: error
    then:
      field: summary
      function: truthy

  shuffle-bearer-auth:
    description: API must use Bearer token authentication
    message: "Security scheme must be HTTP Bearer"
    given: "$.components.securitySchemes[*]"
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            type:
              enum: [http]
            scheme:
              enum: [bearer]

  shuffle-api-response:
    description: Standard API responses should include success boolean
    message: "API response schemas should include success field"
    given: "$.components.schemas.ApiResponse"
    severity: warn
    then:
      field: properties.success
      function: truthy

  shuffle-workflow-id:
    description: Workflow operations should use consistent id parameter naming
    message: "Workflow path parameters should use 'id' for workflow identifier"
    given: "$.paths['/workflows/{id}'][*].parameters[?(@.name == 'id')]"
    severity: warn
    then:
      field: required
      function: truthy

  shuffle-response-200:
    description: All operations must have a 200 response
    message: "Operation must define a 200 response"
    given: "$.paths[*][*].responses"
    severity: error
    then:
      field: "200"
      function: truthy

  shuffle-response-401:
    description: Operations should document 401 Unauthorized response
    message: "Authenticated endpoints should document 401 response"
    given: "$.paths[*].get.responses"
    severity: warn
    then:
      field: "401"
      function: defined

  shuffle-operation-id:
    description: All operations must have an operationId in camelCase
    message: "Operation must have an operationId"
    given: "$.paths[*][*]"
    severity: error
    then:
      field: operationId
      function: truthy

  shuffle-v1-prefix:
    description: All API paths should use /api/v1 prefix (reflected in servers)
    message: "API version should be specified in server URL"
    given: "$.servers[*]"
    severity: warn
    then:
      field: url
      function: pattern
      functionOptions:
        match: "^https?://.*/(api/)?v[0-9]"