Shell · API Governance Rules

Shell API Rules

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

13 Rules error 3 warn 5 info 5
View Rules File View on GitHub

Rule Categories

shell

Rules

warn
shell-operation-id-camel-case
Operation IDs must use camelCase
$.paths[*][get,post,put,patch,delete].operationId
warn
shell-path-kebab-case
Path segments must use kebab-case or curly-brace parameters
$.paths
error
shell-must-have-summary
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
warn
shell-must-have-tags
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
error
shell-must-have-operation-id
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
info
shell-oauth2-security
Shell APIs use OAuth2 client credentials for authentication
$.components.securitySchemes[*]
info
shell-colcocode-required
B2B Mobility endpoints require colCoCode (Collecting Company Code) parameter
$.paths[*][get,post].parameters[*]
error
shell-no-trailing-slash
Paths must not have trailing slashes
$.paths
info
shell-parameters-have-description
All parameters should have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
warn
shell-response-200-must-have-content
200 responses must have content defined
$.paths[*][get,post,put,patch,delete].responses[200]
info
shell-schemas-use-camel-case
Schema property names should use camelCase
$.components.schemas[*].properties
info
shell-pagination-fields
Paginated list responses should include totalCount, currentPage, pageCount
$.components.schemas[*ListResponse]
warn
shell-versioned-servers
Shell API servers must include version in the URL path
$.servers[*].url

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  # Shell API Naming Conventions
  shell-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]+$"

  shell-path-kebab-case:
    description: Path segments must use kebab-case or curly-brace parameters
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}_/-]+)+$"

  shell-must-have-summary:
    description: All operations must have a summary
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: defined

  shell-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

  shell-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

  shell-oauth2-security:
    description: Shell APIs use OAuth2 client credentials for authentication
    severity: info
    given: "$.components.securitySchemes[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object

  shell-colcocode-required:
    description: B2B Mobility endpoints require colCoCode (Collecting Company Code) parameter
    severity: info
    given: "$.paths[*][get,post].parameters[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object

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

  shell-parameters-have-description:
    description: All parameters should have a description
    severity: info
    given: "$.paths[*][get,post,put,patch,delete].parameters[*]"
    then:
      field: description
      function: defined

  shell-response-200-must-have-content:
    description: 200 responses must have content defined
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].responses[200]"
    then:
      field: content
      function: defined

  shell-schemas-use-camel-case:
    description: Schema property names should use camelCase
    severity: info
    given: "$.components.schemas[*].properties"
    then:
      function: schema
      functionOptions:
        schema:
          type: object

  shell-pagination-fields:
    description: Paginated list responses should include totalCount, currentPage, pageCount
    severity: info
    given: "$.components.schemas[*ListResponse]"
    then:
      field: properties
      function: defined

  shell-versioned-servers:
    description: Shell API servers must include version in the URL path
    severity: warn
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "https://api.shell.com/[a-z-]+/v[0-9]+"