Sherwin-Williams · API Governance Rules

Sherwin-Williams API Rules

Spectral linting rules defining API design standards and conventions for Sherwin-Williams.

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

Rule Categories

sherwin

Rules

error
sherwin-williams-must-have-summary
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
warn
sherwin-williams-must-have-tags
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
error
sherwin-williams-must-have-operation-id
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
error
sherwin-williams-no-trailing-slash
Paths must not have trailing slashes
$.paths
warn
sherwin-williams-operation-id-camel-case
Operation IDs must use camelCase
$.paths[*][get,post,put,patch,delete].operationId
error
sherwin-williams-parameters-have-schema
All parameters must have a schema defined
$.paths[*][get,post,put,patch,delete].parameters[*]
error
sherwin-williams-b2b-auth
B2B APIs must have authentication defined
$.security

Spectral Ruleset

sherwin-williams-rules.yml Raw ↑
extends: spectral:oas
rules:
  # Sherwin-Williams API Governance Rules
  sherwin-williams-must-have-summary:
    description: All operations must have a summary
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: defined

  sherwin-williams-must-have-tags:
    description: All operations must have at least one tag
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: defined

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

  sherwin-williams-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: error
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        notMatch: ".*/$"

  sherwin-williams-operation-id-camel-case:
    description: Operation IDs must use camelCase
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  sherwin-williams-parameters-have-schema:
    description: All parameters must have a schema defined
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].parameters[*]"
    then:
      field: schema
      function: defined

  sherwin-williams-b2b-auth:
    description: B2B APIs must have authentication defined
    severity: error
    given: "$.security"
    then:
      function: defined