Vector · API Governance Rules

Vector API Rules

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

17 Rules error 9 warn 8
View Rules File View on GitHub

Rule Categories

health info no openapi operation response schema servers

Rules

error
info-title-required
API title must be present.
$.info
warn
info-title-starts-with-vector
API title should start with "Vector".
$.info.title
warn
info-description-required
API description must be present.
$.info
error
info-version-required
API version must be specified.
$.info
error
openapi-version-3x
Must use OpenAPI 3.x.
$
error
servers-required
Servers array must be defined.
$
warn
servers-description-required
Each server should have a description.
$.servers[*]
error
operation-operationId-required
All operations must have an operationId.
$.paths[*][get,post,put,patch,delete,head]
error
operation-summary-required
All operations must have a summary.
$.paths[*][get,post,put,patch,delete,head]
warn
operation-summary-starts-with-vector
Operation summaries should start with "Vector".
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
All operations should have a description.
$.paths[*][get,post,put,patch,delete,head]
error
response-success-required
Operations must define at least one 2xx response.
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
All responses must have a description.
$.paths[*][*].responses[*]
warn
schema-description-required
Schema definitions should have descriptions.
$.components.schemas[*]
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description
error
health-endpoint-required
Observability API should expose a /health endpoint.
$.paths
warn
servers-expected-domain
Server URLs should be on the 0.1 domain.
$.servers[*].url

Spectral Ruleset

Raw ↑
# vector — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-expected-domain: 1/1 servers on 0.1
#   - merge: kept 16 existing, added 1 measured, upgraded 0
#   - added: servers-expected-domain
extends:
  - spectral:oas
rules:
  info-title-required:
    description: API title must be present.
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-title-starts-with-vector:
    description: API title should start with "Vector".
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Vector
  info-description-required:
    description: API description must be present.
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: API version must be specified.
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  openapi-version-3x:
    description: Must use OpenAPI 3.x.
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  servers-required:
    description: Servers array must be defined.
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-description-required:
    description: Each server should have a description.
    severity: warn
    given: $.servers[*]
    then:
      field: description
      function: truthy
  operation-operationId-required:
    description: All operations must have an operationId.
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head]
    then:
      field: operationId
      function: truthy
  operation-summary-required:
    description: All operations must have a summary.
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head]
    then:
      field: summary
      function: truthy
  operation-summary-starts-with-vector:
    description: Operation summaries should start with "Vector".
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: ^Vector
  operation-description-required:
    description: All operations should have a description.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head]
    then:
      field: description
      function: truthy
  response-success-required:
    description: Operations must define at least one 2xx response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
          - required:
            - '204'
  response-description-required:
    description: All responses must have a description.
    severity: error
    given: $.paths[*][*].responses[*]
    then:
      field: description
      function: truthy
  schema-description-required:
    description: Schema definitions should have descriptions.
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: .+
  health-endpoint-required:
    description: Observability API should expose a /health endpoint.
    severity: error
    given: $.paths
    then:
      field: /health
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the 0.1 domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: 0\.1