Skip to content

feat(api): serve every API path under /api/v1 and deprecate the unversioned paths - #9995

Merged
rubenvdlinde merged 8 commits into
mainfrom
fix/api-path-aliases
Nov 12, 2026
Merged

rubenvdlinde merged 8 commits into
mainfrom
fix/api-path-aliases

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Every OpenRegister API path is now served under /api/v1/ as well as at its unversioned path. The unversioned paths keep working and are deprecated.

  • The scheme. /api/<path> is also served as /api/v1/<path>, with the same controller, requirements and defaults. ApiPathAliases::withVersionedAliases() wraps the declaration in appinfo/routes.php, so a new route gets its alias without anyone writing it: 1,023 aliases today, 45 of them for the nine resources. The aliases come after the original routes, and no unversioned route can match an /api/v1/ path (a test checks that no route starts with /api/{), so the precedence of the originals does not change.
  • No alias for routes that already carry a version (/api/v2/audit, /api/mcp/v1/...) or for standard protocol paths (StandardProtocolPaths: MCP, GraphQL, WFS, iCalendar feeds, metrics, health, federation).
  • files/multipart. POST /api/objects/{register}/{schema}/{id}/files/multipart is the new name of filesMultipart. The old path keeps working and gets no /api/v1/ alias of its own; its successor is /api/v1/.../files/multipart.
  • Deprecation header. UnversionedPathDeprecationMiddleware adds Deprecation: @1794441600 (RFC 9745, 12 November 2026) and Link: </index.php/apps/openregister/api/v1/...>; rel="successor-version" to responses on the unversioned paths. It only decorates. It is registered after ApiVersionMiddleware, so a deprecated contract version's own Deprecation and Link headers win. No Sunset date is set, because none has been decided.
  • OpenAPI document. The server URL is now https://{host}/index.php/apps/openregister/api/v1. Each unversioned path is listed as a deprecated twin (/api/... with a path-level server, deprecated: true and a description naming the successor). The old filesMultipart spelling is not listed: it still answers, with the same Deprecation and Link headers, but its camelCase breaks the kebab-case path rule. A test keeps the twins in step with the versioned paths and checks that filesMultipart stays out.
  • Documented in docs/features/api-generation.md ("Versioned paths") and as REQ-OAS-PATH-001 in openspec/specs/openapi-generation/spec.md.

Spectral, NL API Design Rules ruleset

npx @stoplight/spectral-cli lint openapi.json --ruleset https://static.developer.overheid.nl/adr/ruleset.yaml

The Common Ground checker's local scan (npm run scan:local, rubenvdlinde/CommonGroundChecker#3) agrees on this branch with --register --api-spec openapi.json: openapi and adrvalidator (API Design Rules) both pass, score 90.

Stacking

Stacked on #9985 (problem details), which is in turn built on fix/openapi-api-design-rules. Both PRs use the same StandardProtocolPaths list. Merge in that order. origin/main is merged in (no rebase).

Tests

ApiPathAliasesTest (successors, alias generation, and the shipped routes.php: every unversioned API route has an alias with the same requirements and defaults, no alias reuses a route name, filesMultipart has no v1 alias), UnversionedPathDeprecationMiddlewareTest, MiddlewareRegistrarTest (new order) and OpenApiControllerTest::testUnversionedPathsAreDeprecatedTwins. They fail on main: the classes do not exist there and the document has no /api/v1 server.

Verified locally

  • hydra/scripts/diff-check.sh --base origin/main --gates-timeout 1500 with the floor compare, on a fresh clone of this branch: units, floor, php -l, phpstan and the touched PHPUnit tests pass. The one NEW phpcs finding (line length of the new files/multipart route) is fixed. Gate 67 (contract parity) fails on lib/Contract/EmailLinkReaderInterface.php and ObjectServiceInterface.php, which this branch does not touch: inherited from main. phpcs reports 256 inherited line-length findings in appinfo/routes.php, on lines this branch does not touch.
  • After the fixes and a fresh merge of origin/main: the touched-class tests plus main's new WriteRoutesRequireRequestTokenTest pass (47 tests, 4,952 assertions). php -l and phpcs on the edited files are clean.
  • Spectral with the NL API Design Rules ruleset: 0 findings.
  • Not run: composer check:strict. The integrator runs it.

Not in this PR

  • The frontend still calls the unversioned paths, including filesMultipart in src/mail-sidebar/components/ObjectsTab.vue, so its own calls now carry a Deprecation header. Moving the frontend to /api/v1/ belongs in a separate PR.

Assumptions

  • "Unversioned aliases next to /api/v1/" read as: /api/v1/ is the new canonical form (that is what the include-major-version-in-uri rule asks for), and the existing unversioned paths stay as deprecated aliases.
  • The deprecation date is the date of this change; no sunset date until someone decides one.

AI assistance: drafted with Claude Code (claude-opus-5-5) and reviewed before submission.

…sioned paths

ApiPathAliases adds an /api/v1/ alias of every unversioned API route and
resource to routes.php, after the originals so their precedence stays.
Versioned routes and standard protocol paths get none. files/multipart
is the new name of filesMultipart, which keeps working.

UnversionedPathDeprecationMiddleware adds the RFC 9745 Deprecation header
and a successor-version Link to responses on the unversioned paths.

The root OpenAPI document names /api/v1 in its server URL and lists each
unversioned path as a deprecated twin.

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde marked this pull request as draft November 12, 2026 12:03
The old path still answers with the Deprecation and successor Link headers; the document now passes the kebab-case path rule.

Assisted-by: ClaudeCode:claude-opus-5-5
… their v1 aliases in tests

The deprecation middleware no longer overwrites a Deprecation or Link
header a controller already set, so the favourite and available-actions
responses keep naming their own successor. Route tests that pin one
route per name read the declared routes without the /api/v1 aliases,
and the multipart upload follows main's files-multipart name.

Assisted-by: ClaudeCode:claude-opus-5-5
This was referenced Nov 12, 2026
@rubenvdlinde
rubenvdlinde merged commit dea62bb into main Nov 12, 2026
12 of 18 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ aa0b288

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-specs ✅
test-l10n ❌
test-l10n-parity ❌
format ❌
check-schema-l10n ✅
test-newman-route-ratchet ❌
composer ✅ ✅ 169/169
npm ✅ ✅ 639/639
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ 57637/57862 · 27 skipped (worst of 5 legs: PHP 8.3, NC stable32, pgsql; counts from 5 of 8 legs)
Newman ❌
Playwright ❌ 332/383 · 5 skipped · 106 did not run
Hydra gates ❌

Quality workflow — 2026-11-15 04:03 UTC

Download the full PDF report from the workflow artifacts.

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.

1 participant