Volkswagen · API Governance Rules

Volkswagen API Rules

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

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

Rule Categories

volkswagen

Rules

warn
volkswagen-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
warn
volkswagen-operation-ids-camel-case
OperationIds must use camelCase.
$.paths[*][*].operationId
error
volkswagen-tags-required
Each operation must have at least one tag.
$.paths[*][*]
error
volkswagen-bearer-auth-required
API must declare Bearer authentication.
$.components.securitySchemes
info
volkswagen-country-code-path-param
Operation paths should include a countryCode path parameter.
$.paths[*operation*][post,get].parameters[*]
warn
volkswagen-version-in-server-url
Server URL must include an API version prefix.
$.servers[*].url
warn
volkswagen-catalog-endpoints-get
Catalog endpoints should use GET method.
$.paths[*/catalog/*]
warn
volkswagen-operation-endpoints-post
Operation endpoints (buildability, config, information) should use POST method.
$.paths[*/operation/*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  volkswagen-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-z]*(\\s[A-Z][a-z]*)*)"

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

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

  volkswagen-bearer-auth-required:
    description: API must declare Bearer authentication.
    severity: error
    given: "$.components.securitySchemes"
    then:
      function: truthy

  volkswagen-country-code-path-param:
    description: Operation paths should include a countryCode path parameter.
    severity: info
    given: "$.paths[*operation*][post,get].parameters[*]"
    then:
      field: name
      function: enumeration
      functionOptions:
        values:
          - countryCode
          - brandId
          - modelId
          - typeId

  volkswagen-version-in-server-url:
    description: Server URL must include an API version prefix.
    severity: warn
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: ".*\\/v[0-9]+.*"

  volkswagen-catalog-endpoints-get:
    description: Catalog endpoints should use GET method.
    severity: warn
    given: "$.paths[*/catalog/*]"
    then:
      field: get
      function: truthy

  volkswagen-operation-endpoints-post:
    description: Operation endpoints (buildability, config, information) should use POST method.
    severity: warn
    given: "$.paths[*/operation/*]"
    then:
      field: post
      function: truthy