VKS Integrations · API Governance Rules

VKS Integrations API Rules

Spectral linting rules defining API design standards and conventions for VKS Integrations.

8 Rules error 2 warn 6
View Rules File View on GitHub

Rule Categories

vks

Rules

warn
vks-operation-ids-camel-case
Operation IDs must use camelCase to match VKS API conventions.
$.paths[*][*].operationId
error
vks-require-api-key-security
All VKS API operations require API key authentication.
$.paths[*][*]
error
vks-require-summaries
All operations must have a summary.
$.paths[*][*]
warn
vks-require-descriptions
All operations and schemas must have descriptions.
$.paths[*][*]$.components.schemas[*]
warn
vks-path-params-documented
All path parameters must have descriptions.
$.paths[*][*].parameters[?(@.in == 'path')]
warn
vks-require-401-response
All authenticated operations must define a 401 Unauthorized response.
$.paths[*][get,post,put,patch,delete]
warn
vks-use-iso8601-dates
All date/time fields must use format date-time.
$.components.schemas[*].properties[*][?(@.type == 'string' && @.description)]
warn
vks-work-order-paths-plural
Collection endpoints must use plural noun paths.
$.paths

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas

rules:
  vks-operation-ids-camel-case:
    description: Operation IDs must use camelCase to match VKS API conventions.
    message: "{{property}} must be camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  vks-require-api-key-security:
    description: All VKS API operations require API key authentication.
    message: "Operation {{path}} must define security"
    severity: error
    given: "$.paths[*][*]"
    then:
      field: security
      function: truthy

  vks-require-summaries:
    description: All operations must have a summary.
    message: "Operation {{path}} must have a summary"
    severity: error
    given: "$.paths[*][*]"
    then:
      field: summary
      function: truthy

  vks-require-descriptions:
    description: All operations and schemas must have descriptions.
    message: "{{path}} must have a description"
    severity: warn
    given:
      - "$.paths[*][*]"
      - "$.components.schemas[*]"
    then:
      field: description
      function: truthy

  vks-path-params-documented:
    description: All path parameters must have descriptions.
    message: "Path parameter {{path}} must have a description"
    severity: warn
    given: "$.paths[*][*].parameters[?(@.in == 'path')]"
    then:
      field: description
      function: truthy

  vks-require-401-response:
    description: All authenticated operations must define a 401 Unauthorized response.
    message: "Authenticated operation {{path}} must define a 401 response"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: responses.401
      function: truthy

  vks-use-iso8601-dates:
    description: All date/time fields must use format date-time.
    message: "Date field {{path}} must use format: date-time"
    severity: warn
    given: "$.components.schemas[*].properties[*][?(@.type == 'string' && @.description)]"
    then:
      function: schema
      functionOptions:
        schema:
          if:
            properties:
              description:
                pattern: "(created|updated|started|completed|recorded)"
          then:
            required: ["format"]

  vks-work-order-paths-plural:
    description: Collection endpoints must use plural noun paths.
    message: "Collection paths must use plural nouns"
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^/api/"