Skip to content

spp_api_v2: error responses are FastAPI {detail}, not the RFC 9457 Problem Details the API principles specify #556

Open

Description

@gonzalesedwin1123

Problem

OpenSPP's API guidelines specify RFC 9457 Problem Details (type, title, status, detail,
application/problem+json), and spp_api_v2/schemas/problem_detail.py defines a ProblemDetail schema. But no
spp_api_v2* module registers an exception handler: routers raise HTTPException, and the OCA fastapi error path
(fastapi/error_handlers.py, convert_exception_to_status_body) renders {"detail": ...} as application/json.
The principle doc already carries a note that "a global exception handler should be added".

Examples: 404 {"detail": "Individual not found"}, 422 {"detail": [{"loc": [...], "msg": ...}]}.

Clients (e.g. the OpenFn language-openspp v4 adaptor) currently have to parse both shapes. #434 (spp_attendance
alignment) assumes the v2 stack already emits RFC 9457.

Proposal

Render ProblemDetail (application/problem+json, URN type per the principle's category table) for all
spp_api_v2 endpoints, including bundle per-entry errors and 422 validation errors (errors[]). This changes every
error body, so it needs a release note and ideally a deprecation window (e.g. keep detail populated, which RFC 9457
allows).

Context

Item C of #554 (deferred from PR #555 as a contract change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions