Squillo · API Governance Rules

Squillo API Rules

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

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

Rule Categories

squillo

Rules

warn
squillo-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
warn
squillo-operationid-camel-case
operationId must use camelCase
$.paths[*][*].operationId
error
squillo-tags-required
Every operation must have at least one tag
$.paths[*][*]
warn
squillo-description-required
All operations must have a description
$.paths[*][*].description
error
squillo-response-200-or-201-required
All operations must define a success response
$.paths[*][*].responses
warn
squillo-paths-use-kebab-case
Path segments should use kebab-case
$.paths
hint
squillo-no-inline-schemas-in-responses
Response schemas should use $ref
$.paths[*][*].responses[*].content[*].schema

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  squillo-operation-summary-title-case:
    description: All operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-z0-9]*\\s?)+$"

  squillo-operationid-camel-case:
    description: operationId must use camelCase
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  squillo-tags-required:
    description: Every operation must have at least one tag
    severity: error
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  squillo-description-required:
    description: All operations must have a description
    severity: warn
    given: "$.paths[*][*].description"
    then:
      function: truthy

  squillo-response-200-or-201-required:
    description: All operations must define a success response
    severity: error
    given: "$.paths[*][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ['200']
            - required: ['201']
            - required: ['202']
            - required: ['204']

  squillo-paths-use-kebab-case:
    description: Path segments should use kebab-case
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(\\/[a-z0-9{}\\-]*)+$"

  squillo-no-inline-schemas-in-responses:
    description: Response schemas should use $ref
    severity: hint
    given: "$.paths[*][*].responses[*].content[*].schema"
    then:
      function: schema
      functionOptions:
        schema:
          required: ['$ref']