ObjectStackObjectStack

Versioning

Versioning protocol schemas

API Versioning Protocol

Defines how API versions are negotiated between client and server. Supports multiple versioning strategies and deprecation lifecycle management.

Architecture Alignment:

  • Salesforce: URL path versioning (v57.0, v58.0)
  • Stripe: Date-based versioning (2024-01-01)
  • Kubernetes: API group versioning (v1, v1beta1)
  • GitHub: Accept header versioning (application/vnd.github.v3+json)
  • Microsoft Graph: URL path versioning (v1.0, beta)

Source: packages/spec/src/api/versioning.zod.ts

TypeScript Usage

import { VersionDefinitionSchema, VersionNegotiationResponseSchema, VersionStatus, VersioningConfigSchema, VersioningStrategy } from '@objectstack/spec/api';
import type { VersionDefinition, VersionNegotiationResponse, VersionStatus, VersioningConfig, VersioningStrategy } from '@objectstack/spec/api';

// Validate data
const result = VersionDefinitionSchema.parse(data);

VersionDefinition

Properties

PropertyTypeRequiredDescription
versionstringVersion identifier (e.g., "v1", "v2beta1", "2025-01-01")
statusEnum<'preview' | 'current' | 'supported' | 'deprecated' | 'retired'>Lifecycle status of this version
releasedAtstringRelease date (ISO 8601, e.g., "2025-01-15")
deprecatedAtstringoptionalDeprecation date (ISO 8601). Only set for deprecated/retired versions
sunsetAtstringoptionalSunset date (ISO 8601). After this date, the version returns 410 Gone
migrationGuidestringoptionalURL to migration guide for upgrading from this version
descriptionstringoptionalHuman-readable description or release notes summary
breakingChangesstring[]optionalList of breaking changes (for preview/new versions)

VersionNegotiationResponse

Properties

PropertyTypeRequiredDescription
currentstringCurrent recommended API version
requestedstringoptionalVersion requested by the client
resolvedstringResolved API version for this request
supportedstring[]All supported version identifiers
deprecatedstring[]optionalDeprecated version identifiers
versions{ version: string; status: Enum<'preview' | 'current' | 'supported' | 'deprecated' | 'retired'>; releasedAt: string; deprecatedAt?: string; … }[]optionalFull version definitions with lifecycle metadata

VersionStatus

Allowed Values

  • preview
  • current
  • supported
  • deprecated
  • retired

VersioningConfig

Properties

PropertyTypeRequiredDescription
strategyEnum<'urlPath' | 'header' | 'queryParam' | 'dateBased'>How the API version is specified by clients
currentstringThe current/recommended API version identifier
defaultstringFallback version when client does not specify one
versions{ version: string; status: Enum<'preview' | 'current' | 'supported' | 'deprecated' | 'retired'>; releasedAt: string; deprecatedAt?: string; … }[]All available API versions with lifecycle metadata
headerNamestringHTTP header name for version negotiation (header/dateBased strategies)
queryParamNamestringQuery parameter name for version specification (queryParam strategy)
urlPrefixstringURL prefix before version segment (urlPath strategy)
deprecation{ warnHeader: boolean; sunsetHeader: boolean; linkHeader: boolean; rejectRetired: boolean; … }optionalDeprecation lifecycle behavior
includeInDiscoverybooleanInclude version information in the API discovery endpoint

VersioningStrategy

Allowed Values

  • urlPath
  • header
  • queryParam
  • dateBased

On this page