Skip to content

馃悰(api) fix server errors on query param validation errors - #644

Open
piptouque wants to merge 1 commit into
openfun:mainfrom
piptouque:fix_server_error_query_params
Open

piptouque wants to merge 1 commit into
openfun:mainfrom
piptouque:fix_server_error_query_params

Conversation

@piptouque

@piptouque piptouque commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Purpose

Ralph should not return 500 errors for malformed IRI query parameters, and validation errors on agent.
You may check this by:

  • querying with any malformed IRI in verb or activity,
  • querying with a valid JSON but wrong structure in agent.

Proposal

Per the specs,
the server should return 400 (Bad Request) errors.
But to align with the rest of the parameters, we use
the default FastAPI validation of IRI (returns 422 - Unprocessable Entity).

  • Add an IRIStr scalar type deriving from string to use in validations
  • Set the verb and activity types to IRIStr instead of str in /statements GET
  • Set the agent type to Json[BaseXapiAgent] instead of plain Json in /statements GET

@piptouque
piptouque force-pushed the fix_server_error_query_params branch 5 times, most recently from 8392668 to d849165 Compare September 18, 2026 12:02
Ralph should not return 500 errors for malformed
IRI and `agent` query parameters.
@piptouque
piptouque force-pushed the fix_server_error_query_params branch from d849165 to d8f6ac8 Compare September 18, 2026 14:01

This branch has not been deployed

No deployments
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