VNC · API Governance Rules

VNC API Rules

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

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

Rule Categories

vnc

Rules

warn
vnc-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
warn
vnc-path-kebab-case
Path segments must use kebab-case.
$.paths
warn
vnc-operation-ids-camel-case
OperationIds must use camelCase.
$.paths[*][*].operationId
error
vnc-tags-required
Each operation must have at least one tag.
$.paths[*][*]
warn
vnc-error-response-schema
Error responses (4xx/5xx) must reference the Error schema.
$.paths[*][*].responses[4,5][0-9][0-9]
warn
vnc-api-version-in-server
Server URLs must include an API version path segment.
$.servers[*].url
error
vnc-basic-auth-security
The API must declare Basic authentication as a security scheme.
$.components.securitySchemes
info
vnc-pagination-limit-parameter
List operations should support a limit query parameter for pagination.
$.paths[*].get.parameters[?(@.name == 'limit')]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  vnc-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]*)*)"

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

  vnc-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]*$"

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

  vnc-error-response-schema:
    description: Error responses (4xx/5xx) must reference the Error schema.
    severity: warn
    given: "$.paths[*][*].responses[4,5][0-9][0-9]"
    then:
      field: content
      function: truthy

  vnc-api-version-in-server:
    description: Server URLs must include an API version path segment.
    severity: warn
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: ".*\\/[0-9]+\\.[0-9]+.*"

  vnc-basic-auth-security:
    description: The API must declare Basic authentication as a security scheme.
    severity: error
    given: "$.components.securitySchemes"
    then:
      function: truthy

  vnc-pagination-limit-parameter:
    description: List operations should support a limit query parameter for pagination.
    severity: info
    given: "$.paths[*].get.parameters[?(@.name == 'limit')]"
    then:
      field: schema.type
      function: enumeration
      functionOptions:
        values:
          - integer