Repository navigation
feat(api): serve every API path under /api/v1, problem details and an OpenAPI document - #2367
Merged
Merged
Conversation
OpenAPI document Portaliq's own JSON API now follows the NL API Design Rules that hold for every endpoint: - every route under /api/ is also served under /api/v1/, with the same controller, requirements and defaults; the unversioned paths keep answering and announce their successor with a Deprecation header (@1794441600, 2026-11-12) and a Link header with rel="successor-version"; - every API response carries API-Version, the installed version; - a JSON error response is served as application/problem+json with type, title, status and detail, keeping every member it already had; - GET /api/v1/openapi.json serves openapi.json, public, with Access-Control-Allow-Origin: *. External protocol paths (the traffic browser scripts, identity provider callbacks, the health check and the Prometheus metrics) are left alone: no alias, no version header, no problem details rewrite. openapi.json is new: it describes the 144 versioned operations, drawn from appinfo/routes.php and the controllers' docblocks, signatures and status codes. Spectral with the ADR ruleset finds nothing. Tests pin the middleware, the aliases (a twin for every unversioned route, no alias taking a request meant for another route) and keep openapi.json and routes.php in step both ways. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
rubenvdlinde
requested review from
Rem-Dam,
SudoThijn,
WilcoLouwerse,
bbrands02,
remko48 and
rjzondervan
as code owners
November 12, 2026 22:11
The version header and the problem details rewrite now apply only to the new /api/v1/ paths. An unversioned path keeps its body, content type and headers as before and only announces its successor (Deprecation + Link). Assisted-by: ClaudeCode:claude-opus-5-5
Contributor
Quality Report — ConductionNL/portaliq @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ❌ | ||||
| psalm | ❌ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-specs | ❌ | ||||
| check-manifest | ❌ | ||||
| format | ❌ | ||||
| check-l10n-js | ✅ | ||||
| check-schema-l10n | ❌ | ||||
| check-reuse | ✅ | ||||
| composer | ❌ | ✅ 108/108 | |||
| npm | ✅ | ✅ 985/985 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ✅ | ||||
| lockfile sync | ✅ | ||||
| PHPUnit | ❌ 4521/4526 · 1 skipped | ||||
| Newman | ✅ 1/1 | ||||
| Playwright | ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development. |
||||
| Hydra gates | ❌ |
Quality workflow — 2026-11-15 04:19 UTC
Download the full PDF report from the workflow artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Portaliq's own JSON API now follows the NL API Design Rules that hold for every endpoint, using the scheme OpenRegister introduced (ConductionNL/openregister#9985 for problem details, ConductionNL/openregister#9995 for
/api/v1paths), adapted to the fleet'sApiContractMiddleware.appinfo/routes.phppasses its table throughApiPathAliases::withVersionedAliases(), which adds a/api/v1/twin of every unversioned API route with the same controller, requirements and defaults, under av1postfix. The twins come right after the last route the app already declares under/api/v1/(so those keep their paths) and before everything else (so no/api/{slug}route or catch-all can answer a/api/v1/request).Deprecation: @1794441600(2026-11-12) andLink: </index.php/apps/portaliq/api/v1/...>; rel="successor-version".API-Versionon every API response, byApiContractMiddleware, registered first so it sees the final response of every other middleware. Error bodies keep every member they had.lib/Middleware/Support/StandardProtocolPaths.php).openapi.json(new): OpenAPI 3.0.3, serverhttps://{host}/index.php/apps/portaliq/api/v1, 144 operations drawn fromappinfo/routes.phpand the controllers (docblocks, signatures, status codes, auth attributes), served atGET /api/v1/openapi.json(public,Access-Control-Allow-Origin: *).openspec/specs/api-contract/spec.mddescribes the contract.Tests
ApiContractMiddlewareTest: version header, problem details, deprecation and successor headers, no deprecation on a versioned path, protocol paths untouched.ApiPathAliasesTest: successors; alias placement; the API fallback gets no alias; route parity: every deprecated route of the shipped table has a/api/v1/twin with the same name, requirements and defaults, and a request on the twin's path reaches it (the router is simulated in declaration order); no alias takes a request meant for a declared versioned route.OpenApiDocumentTest: the server is versioned, and openapi.json and routes.php describe the same versioned operations, both ways.OpenApiControllerTest: the document is served publicly with CORS, 404 when missing.Verified locally
hydra/scripts/diff-check.sh --base origin/development: php -l, phpcs, phpstan and phpunit green on the changed files.composer check:strictonce: lint, phpcs, phpstan and the full PHPUnit suite green; phpmd and psalm red on inherited findings only, none in the new code.npm run scan:local -- <checkout> --register --api-spec openapi.json): openapi fail (no specification) before, pass after; adrvalidator warn (no specification) before, pass after (Spectral with the ADR ruleset: 0 errors, 0 warnings)./api/traffic-client.js,/api/traffic-recorder.js), which are JavaScript, and the identity provider callbacks under/portal/api/session/oidc/and/portal/api/session/broker/.Notes
{}); it describes paths, parameters, auth, status codes and media types, not body shapes.This change was prepared with AI assistance (Claude Code) and reviewed before submission.