admin
admin copied to clipboard
Docs error after upgrading to API Platform v4.0.2 (backend) and API Platform Admin v4.0.1 (frontend)
Hi API Platform Admin Team,
I was previously using API Platform v3.3.7 for my backend and API Platform Admin v3.4.7 for my frontend. After upgrading to API Platform v4.0.2 and API Platform Admin v4.0.1, I encountered the following error on the frontend :
Cannot fetch API documentation:
The API documentation has no "http://www.w3.org/ns/hydra/core#supportedClass" key or its value is not an array.
Have you verified that CORS is correctly configured in your API ?
The hydra-prefixed tags have been removed from my APIs as expected, but the API responses are otherwise in the correct format.
Interestingly, if I revert the backend to API Platform v3.3.7 while keeping the frontend at API Platform Admin v4.0.1, everything works fine. The issue only appears when both the backend and frontend are on the latest versions (v4.x).
Thank you for your help!
The issue only appears when both the backend and frontend are on the latest versions (v4.x).
These versions are not correlated. AP Admin major version change from 3.x to 4.x was done only because of adding React Admin 5.x support what was a breaking change.
@alanpoulain @dunglas can api doc parser be compatible with the latest two versions of API Platform?
It's maybe because we removed the hydra: prefix by default. We'll take a look.
Could you please try to set the hydra_prefix of the API component to true to see if this workaround works:
# api/config/packages/api_platform.yaml
api_platform:
serializer:
hydra_prefix: true
https://api-platform.com/docs/core/upgrade-guide/
Set the hydra_prefix of the API component to true works.
Thanks, it's OK with hydra_prefix: true