-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
https://api-platform.com/docs/admin/validation/ currently states some details on how client and server side validation can be added.
In situations where we are not using React Admin but do want to leverage the @api-platform/admin
functionality to handle hydra / jsonld HTTP 422 validation responses, things become more complex.
tldr; the response gets expanded, and documentation would be helpful 1) for what reason, and 2) how to cope with expanded responses in userland.
Context
Our application has an additional React application that's living next to the React Admin application, and leverages helpful utilities like the fetchJsonld
and authentication. When trying to handle validation errors on a form, the thrown http 422 error content does look different from the actual response payload as internally the structure gets expanded using the API Platform jsonld documentation.
Response payload

Response error object (in debugger)
Related issues api-platform/admin#548 api-platform/admin#553 api-platform/admin#528 https://github.com/api-platform/admin/pull/352/files
Questions to answer
- How to cope with jsonld response objects that are expanded according to the API Platform's docs?
- As can be seen on the jsonld lib, the
compact
method could be used. Might requirefetchHydra
's documentLoader, so how to compac the error response again? - Maybe add features to allow userland to
- add functionality to
fetchHydra
to not expand the response (e.g. in case of non http 20x responses) - export the documentLoader in API Platform's
fetchHydra
so that one can be reused
- add functionality to