APIGit · API Governance Rules

APIGit API Rules

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

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

Rule Categories

info operation response servers

Rules

warn
info-title-prefix
API title must start with 'APIGit'.
$.info
error
info-description-required
API must have a description.
$.info
error
servers-https
All server URLs must use HTTPS.
$.servers[*]
warn
operation-summary-prefix
Operation summaries must start with 'APIGit'.
$.paths[*][get,post,put,patch,delete]
error
operation-id-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
error
response-success-required
Every operation must have a 2xx response.
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  info-title-prefix:
    description: API title must start with 'APIGit'.
    severity: warn
    given: '$.info'
    then:
      field: title
      function: pattern
      functionOptions:
        match: '^APIGit'

  info-description-required:
    description: API must have a description.
    severity: error
    given: '$.info'
    then:
      field: description
      function: truthy

  servers-https:
    description: All server URLs must use HTTPS.
    severity: error
    given: '$.servers[*]'
    then:
      field: url
      function: pattern
      functionOptions:
        match: '^https://'

  operation-summary-prefix:
    description: Operation summaries must start with 'APIGit'.
    severity: warn
    given: '$.paths[*][get,post,put,patch,delete]'
    then:
      field: summary
      function: pattern
      functionOptions:
        match: '^APIGit'

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

  response-success-required:
    description: Every operation must have a 2xx response.
    severity: error
    given: '$.paths[*][get,post,put,patch,delete].responses'
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ['200']
            - required: ['201']
            - required: ['204']