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

TypeError in ApiPlatformDescriber: Argument #1 ($documentation) must be of type ApiPlatform\Documentation\DocumentationInterface #2089

Closed
Aerendir opened this issue Mar 30, 2023 · 13 comments

Comments

@Aerendir
Copy link

With ApiPlatform v.3.1.6

TypeError: Nelmio\ApiDocBundle\Describer\ApiPlatformDescriber::__construct(): Argument #1 ($documentation) must be of type ApiPlatform\Documentation\DocumentationInterface, ApiPlatform\OpenApi\OpenApi given, called in /srv/app/var/cache/test/ContainerU6TwUpp/getNelmioApiDoc_Describers_ApiPlatformService.php on line 24

@cruiservlad
Copy link

Have the same issue. @Aerendir do you found solution?

@Aerendir
Copy link
Author

Aerendir commented Apr 10, 2023

@cruiservlad , there is no solution other than adapt the code to the new interface.

But as I don't know much about the project, I don't know if it is required to maintain a retro-compatibility or not.

In the meantime, I simply didn't updated to the latest version of ApiPlatform, waiting for direction from maintainers of this bundle.

@BPavol
Copy link

BPavol commented Apr 11, 2023

I have same issue. For me it is caused by service lexik_jwt_authentication.api_platform.openapi.factory -> Lexik\Bundle\JWTAuthenticationBundle\OpenApi\OpenApiFactory::__invoke(). It returns \ApiPlatform\OpenApi\OpenApi. That class does not extends \ApiPlatform\Documentation\DocumentationInterface.

That problem should be fixed in api-platform/core or lexik/jwt-authentication-bundle package.

@AlphaX343
Copy link

AlphaX343 commented Jun 12, 2023

Hey @Aerendir, do you have news from the maintainers?
I have the same issue

@Aerendir
Copy link
Author

No, as you can see, no one replied 😔

In the meantime, I'm using a fixed constraint in Composer:

    "require-dev": {
        ...
        "nelmio/api-doc-bundle": "dev-master#523e27cb836573e9b684b823311cdc4f91794c51",
        ...

@mimo-lbp
Copy link

It works for you ? Because "dev-master-xxx..." doesn't for me

@mimo-lbp
Copy link

mimo-lbp commented Jun 12, 2023

How i fix this error :

  • Removed type "DocumentationInterface" in vendor\nelmio\api-doc-bundle\Describer\ApiPlatformDescriber.php in front of parameter 1 $documentation

image
image

  • "nelmio/api-doc-bundle": "^4.11",
    
  • "nelmio/cors-bundle": "^2.3",
    

@Aerendir
Copy link
Author

@mimo-lbp , this is not a fix as at next composer update the changes will be overwritten.

Try to set the repositories to use my PR: https://stackoverflow.com/a/47610532/1399706

@soyuka
Copy link
Contributor

soyuka commented Jun 16, 2023

Lmk if I can provide a fix in API Platform it's also possible. I'm available on the Symfony slack today.

@mimo-lbp
Copy link

mimo-lbp commented Jun 16, 2023

I don't think the error come from Api platform

In vendor\nelmio\api-doc-bundle\Describer\ApiPlatformDescriber.php
errornelmio

When fix ?

@GuilhemN GuilhemN mentioned this issue Jun 16, 2023
@GuilhemN
Copy link
Collaborator

Sorry for the late reply, #2109 should fix this issue.
It is released in 4.12.0, https://github.com/nelmio/NelmioApiDocBundle/releases/tag/v4.12.0

Can you give it a try? Thanks!

@Aerendir
Copy link
Author

Aerendir commented Jun 16, 2023

@GuilhemN , yes, it will fix the issue 🎉 I'll give it a try in the afternoon or tomorrow morning.

Thank you!

@Aerendir
Copy link
Author

I confirm it works! 🎉

Many thank you!

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 a pull request may close this issue.

7 participants