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

[Bug]: Nelmio interprets PHPDoc @mixin doc bloc #2412

Open
LucileDT opened this issue Dec 24, 2024 · 2 comments
Open

[Bug]: Nelmio interprets PHPDoc @mixin doc bloc #2412

LucileDT opened this issue Dec 24, 2024 · 2 comments
Labels

Comments

@LucileDT
Copy link

LucileDT commented Dec 24, 2024

Version

4.23

Description

Scenario:

  • create a class schema like this theoretical first example
  • create a controller TheoricalController with a route theorical_route referenced in Nelmio:
use Nelmio\ApiDocBundle\Annotation\Model;

#[Route("/api/theorical_route", name: "theorical_route", methods: ["GET"])]
#[OA\Response(
    response: 200,
    description: "Model found",
    content: new OA\JsonContent(ref: new Model(type: ClassB::class))
)]
public function theoricalMethod() {}
  • generate the OpenApi yml file somewhere: $output = $this->renderOpenApi->render('yaml', 'default');

Expected behaviour:

  • the OpenApi yml file is correctly generated
  • the Nelmio documentation is accessible as usual

Current behaviour:

  • the OpenApi file generation fails
  • accessing the Nelmio doc throws a 500 error [Semantical Error] The annotation "@mixin" in class App\ClassB was never imported. Did you maybe forget to add a "use" statement for this annotation?

JSON OpenApi

I can't share this data.

Additional context

No response

@LucileDT LucileDT added the bug label Dec 24, 2024
@DjordyKoert
Copy link
Collaborator

DjordyKoert commented Jan 6, 2025

accessing the Nelmio doc throws a 500 error [Semantical Error] The annotation "@mixin" in class App\ClassB was never imported. Did you maybe forget to add a "use" statement for this annotation?

Do you maybe have the line / file where the exception is coming from?

@DjordyKoert
Copy link
Collaborator

Can you try doing:

\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName('mixin');

https://stackoverflow.com/questions/70985035/the-annotation-mixin-in-class-carbon-carbon-was-never-imported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants