Skip to content

feat(api): add version negotiation middleware with backward-compatible schema migration#855

Merged
temma02 merged 1 commit into
StellerCraft:mainfrom
Darkdruce:feat/api-versioning-schema-migration-middleware
Jun 27, 2026
Merged

feat(api): add version negotiation middleware with backward-compatible schema migration#855
temma02 merged 1 commit into
StellerCraft:mainfrom
Darkdruce:feat/api-versioning-schema-migration-middleware

Conversation

@Darkdruce

Copy link
Copy Markdown
Contributor

Closes #760

Adds withVersionMigration middleware for backward-compatible schema migration on deployment routes.

  • Version negotiated via Accept-Version: application/vnd.craft.v1+json header
  • v1→internal migration: flat repositoryName field maps to nested repository.name
  • v2→internal: identity (v2 is the internal format)
  • Unknown version returns 406 Not Acceptable
  • Missing header defaults to v2 (latest) with X-Api-Deprecation-Warning response header and console warning
  • Migrated body attached as req.migratedBody for downstream handlers
  • X-Api-Version stamped on all responses
  • Tests cover v1 migration, v2 passthrough, missing header default, 406 for unknown version, and response headers

@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@Darkdruce Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@temma02 temma02 merged commit 80409d2 into StellerCraft:main Jun 27, 2026
0 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build API Versioning Middleware with Backward-Compatible Schema Migration Negotiation

2 participants