Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs error after upgrading to API Platform v4.0.2 (backend) and API Platform Admin v4.0.1 (frontend) #583

Open
ekergreis opened this issue Sep 29, 2024 · 6 comments

Comments

@ekergreis
Copy link

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!

@PawelSuwinski
Copy link
Contributor

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.

@fzaninotto
Copy link
Contributor

@alanpoulain @dunglas can api doc parser be compatible with the latest two versions of API Platform?

@dunglas
Copy link
Member

dunglas commented Sep 30, 2024

It's maybe because we removed the hydra: prefix by default. We'll take a look.

@dunglas
Copy link
Member

dunglas commented Sep 30, 2024

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/

@valentin-dassonville
Copy link
Contributor

Set the hydra_prefix of the API component to true works.

@ekergreis
Copy link
Author

Thanks, it's OK with hydra_prefix: true

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

No branches or pull requests

5 participants