Repository navigation
fix(api): serve the API's JSON errors as RFC 9457 problem details - #9985
Merged
Merged
Conversation
… serve it Assisted-by: ClaudeCode:claude-opus-5-5
…component Assisted-by: ClaudeCode:claude-opus-5-5
ProblemDetailsMiddleware turns a 4xx or 5xx JSON response under /api/ into application/problem+json with type, title, status, detail and instance, keeping every member the body already had. MCP, GraphQL, WFS, iCalendar feeds, metrics, health and federation keep their own formats. The root OpenAPI document describes every error response with a Problem schema. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
This was referenced Nov 12, 2026
Contributor
Quality Report — ConductionNL/openregister @
|
| 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 | ❌ 56591/56799 · 27 skipped (worst of 3 legs: PHP 8.3, NC stable32, pgsql; counts from 3 of 8 legs) | ||||
| Newman | ❌ | ||||
| Playwright | ❌ 237/324 · 5 skipped · 164 did not run | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-11-14 08:52 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 this changes
OpenRegister's own REST API now answers its JSON errors as RFC 9457 problem details (
application/problem+json).ProblemDetailsMiddleware(Nextcloud middleware, registered first so itsafterControllersees the final response, including the responses other middlewares build from exceptions) turns a 4xx or 5xxJSONResponseunder/api/into a problem document withtype(about:blank),title(the reason phrase),status,detail(from the body'smessage, elseerror) andinstance(the request path without its query string).errorormessagesee no difference. A member that already uses a problem name (for examplestatus: "error") is kept as it is; RFC 9457 section 3.1 tells consumers to ignore a member with the wrong type.ProblemDetailsBuilder; its interface gainsbuild(), which the class already had.Protocol paths left untouched
StandardProtocolPathslists them: MCP (/api/mcp, JSON-RPC 2.0, and its/api/mcp/v1discovery), GraphQL (/api/graphql), OGC WFS (/api/geo/{register}/{schema}/wfs), iCalendar feeds (/api/public/calendar-feeds/), Prometheus metrics (/api/metrics), the health check (/api/health) and federation between instances (/api/federation/, which older peers parse)..well-known,oauth2andwebpushare not under/api/, so the middleware never sees them.appinfo/routes.phphas no ZGW (ZRC/ZTC/DRC) or OData route: those APIs are served by other apps, so there was nothing of theirs to exclude here.OpenAPI document
Every 4xx and 5xx response in the root
openapi.jsonis nowapplication/problem+jsonwithallOf: [Problem, <the endpoint's existing error schema>]. The four error responses that had no content (Nextcloud's own 401 and 412) get theProblemschema too.info.descriptionsays errors are problem details.Spectral, NL API Design Rules ruleset
npx @stoplight/spectral-cli lint openapi.json --ruleset https://static.developer.overheid.nl/adr/ruleset.yamlfix/openapi-api-design-rules, which this branch builds on: 54 findings, 52 of themuse-problem-schemause-problem-schema52 to 0. Left: 1paths-kebab-case(filesMultipart) and 1include-major-version-in-uri, which the path aliases PR handles.Stacking
Built on
fix/openapi-api-design-rules(queued for the integrator), with main merged in. Merge that one first; this diff then shrinks to this change.Tests
ProblemDetailsMiddlewareTest(9),StandardProtocolPathsTest(16),MiddlewareRegistrarTest(new order) andOpenApiControllerTest::testErrorResponsesAreProblemDetails. All fail on main: the classes do not exist there, the registrar order differs, and the document test fails against the old document (checked by restoring it).Verified locally
origin/main(hydra/scripts/diff-check.sh): no NEW findings. units, floor compare, php -l, phpcs, phpstan and the touched-class PHPUnit runs pass. The gate runner hit the diff check's 300 s cut-off, so it ran once on its own: every gate passes except gate 67 (openregister-contract-parity), which reportslib/Contract/EmailLinkReaderInterface.phpandObjectServiceInterface.phpout of step with hydra-gates; this branch does not touchlib/Contract/, so that is inherited.composer check:strictwas not run: the box is shared and memory-limited today, and the brief's checks (diff check, touched-class tests, floor compare) cover this change.ComponentDefinitionTest: OK.appinfo/routes.phpon lines this change does not touch.Assumptions
AI assistance: drafted with Claude Code (claude-opus-5-5) and reviewed before submission.