Salad Transcription API · API Governance Rules

Salad Transcription API API Rules

Spectral linting rules defining API design standards and conventions for Salad Transcription API.

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

Rule Categories

salad

Rules

error
salad-operation-summary-required
All operations must have a summary.
$.paths[*][*]
warn
salad-api-key-header-required
Salad API uses Salad-Api-Key header for authentication.
$.paths[*][*].parameters[*]
error
salad-response-200-required
All operations must define a 200 success response.
$.paths[*][*].responses
warn
salad-content-type-json
Request bodies should use application/json.
$.paths[*][*].requestBody.content
hint
salad-info-contact
API info should include contact details.
$.info
error
salad-servers-defined
API must define at least one server.
$

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:

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

  salad-api-key-header-required:
    description: Salad API uses Salad-Api-Key header for authentication.
    message: "Operation should document Salad-Api-Key header parameter."
    severity: warn
    given: "$.paths[*][*].parameters[*]"
    then:
      function: schema
      functionOptions:
        schema:
          if:
            properties:
              name:
                const: Salad-Api-Key
          then:
            properties:
              in:
                const: header

  salad-response-200-required:
    description: All operations must define a 200 success response.
    message: "Operation must define a 200 success response."
    severity: error
    given: "$.paths[*][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          required: ["200"]

  salad-content-type-json:
    description: Request bodies should use application/json.
    message: "Request body should use application/json content type."
    severity: warn
    given: "$.paths[*][*].requestBody.content"
    then:
      function: schema
      functionOptions:
        schema:
          required: ["application/json"]

  salad-info-contact:
    description: API info should include contact details.
    message: "API info should include contact information."
    severity: hint
    given: "$.info"
    then:
      field: contact
      function: truthy

  salad-servers-defined:
    description: API must define at least one server.
    message: "API must define at least one server URL."
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy