Spinnaker · API Governance Rules

Spinnaker API Rules

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

8 Rules error 2 warn 5 info 1
View Rules File View on GitHub

Rule Categories

spinnaker

Rules

warn
spinnaker-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
warn
spinnaker-tags-title-case
All tags must use Title Case
$.tags[*].name
error
spinnaker-operation-id
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
error
spinnaker-operation-tags
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
spinnaker-operation-description
All operations should have a description
$.paths[*][get,post,put,patch,delete]
info
spinnaker-application-path-structure
Application-scoped paths must include {application} parameter
$.paths./applications/{application}[*]~
warn
spinnaker-get-response-schema
GET operations must define response schemas
$.paths[*].get.responses.200
warn
spinnaker-security-defined
API should have security schemes defined
$.components.securitySchemes

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  spinnaker-operation-summary-title-case:
    description: All operation summaries must use Title Case
    message: Operation summary "{{value}}" should be in Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*([ ][A-Z][a-zA-Z0-9]*)*$"

  spinnaker-tags-title-case:
    description: All tags must use Title Case
    message: Tag "{{value}}" should be in Title Case
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*([ ][A-Z][a-zA-Z0-9]*)*$"

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

  spinnaker-operation-tags:
    description: All operations must have at least one tag
    message: Operation must have at least one tag
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  spinnaker-operation-description:
    description: All operations should have a description
    message: Operation should have a description
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: description
      function: truthy

  spinnaker-application-path-structure:
    description: Application-scoped paths must include {application} parameter
    message: Application-scoped paths should use /applications/{application}/ prefix
    severity: info
    given: "$.paths./applications/{application}[*]~"
    then:
      function: defined

  spinnaker-get-response-schema:
    description: GET operations must define response schemas
    message: GET operation should define a response schema
    severity: warn
    given: "$.paths[*].get.responses.200"
    then:
      function: truthy

  spinnaker-security-defined:
    description: API should have security schemes defined
    message: Security schemes should be defined for Spinnaker Gate authentication
    severity: warn
    given: "$.components.securitySchemes"
    then:
      function: truthy