Vital · API Governance Rules

Vital API Rules

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

9 Rules error 3 warn 5 info 1
View Rules File View on GitHub

Rule Categories

vital

Rules

error
vital-info-title-junction-or-vital
API title must be "Junction API", or a Vital-prefixed sub-API title.
$.info.title
warn
vital-info-contact-url-junction-docs
API contact.url should point to docs.junction.com.
$.info.contact
warn
vital-servers-regional-set
Servers list should include US and EU regional production and sandbox base URLs.
$.servers
error
vital-server-url-allowed
Server URLs must use the api.{region}.junction.com or api.sandbox.{region}.junction.com pattern.
$.servers[*].url
error
vital-paths-versioned
All paths must be versioned under /v1/, /v2/, /v3/, or grouped namespace (/aggregate/, /lab_report/).
$.paths[*]~
warn
vital-operation-operation-id-snake-case
Operation IDs follow snake_case (Fern convention).
$.paths[*][*].operationId
warn
vital-operation-tags-required
Every operation should declare at least one tag.
$.paths[*][get,post,patch,put,delete]
info
vital-operation-summary-title-case
Operation summaries use Title Case.
$.paths[*][*].summary
warn
vital-security-api-key-header
Document an X-Vital-API-Key apiKey security scheme.
$.components.securitySchemes

Spectral Ruleset

Raw ↑
extends:
- spectral:oas

documentationUrl: https://github.com/api-evangelist/vital-io

rules:
  # Junction-specific conventions discovered from upstream OpenAPI 3.1 spec
  # (https://github.com/tryVital/vital-fern-api).

  vital-info-title-junction-or-vital:
    description: API title must be "Junction API", or a Vital-prefixed sub-API title.
    given: $.info.title
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^(Junction API|Vital .* API|Vital Sense API|Vital Wearables Data API)$"

  vital-info-contact-url-junction-docs:
    description: API contact.url should point to docs.junction.com.
    given: $.info.contact
    severity: warn
    then:
      field: url
      function: pattern
      functionOptions:
        match: ".*docs\\.junction\\.com.*"

  vital-servers-regional-set:
    description: Servers list should include US and EU regional production and sandbox base URLs.
    given: $.servers
    severity: warn
    then:
      function: length
      functionOptions:
        min: 2

  vital-server-url-allowed:
    description: Server URLs must use the api.{region}.junction.com or api.sandbox.{region}.junction.com pattern.
    given: $.servers[*].url
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^https://api(\\.sandbox)?\\.(us|eu)\\.junction\\.com/?$"

  vital-paths-versioned:
    description: All paths must be versioned under /v1/, /v2/, /v3/, or grouped namespace (/aggregate/, /lab_report/).
    given: $.paths[*]~
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^/(v\\d+|aggregate|lab_report)/"

  vital-operation-operation-id-snake-case:
    description: Operation IDs follow snake_case (Fern convention).
    given: $.paths[*][*].operationId
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-z0-9_]*$"

  vital-operation-tags-required:
    description: Every operation should declare at least one tag.
    given: $.paths[*][get,post,patch,put,delete]
    severity: warn
    then:
      field: tags
      function: truthy

  vital-operation-summary-title-case:
    description: Operation summaries use Title Case.
    given: $.paths[*][*].summary
    severity: info
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"

  vital-security-api-key-header:
    description: Document an X-Vital-API-Key apiKey security scheme.
    given: $.components.securitySchemes
    severity: warn
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            ".*":
              type: object
              properties:
                type: {enum: [apiKey, oauth2, http]}
                in: {enum: [header, query]}
                name: {type: string}