nelmio/NelmioApiDocBundle

[Bug]: Documentation is deprecated

Opened this issue · 4 comments

Version

4.28.0

Description

The documentation is deprecated.

For example,

        response: 200,
        description: 'Returns the rewards of an user',
        content: new OA\JsonContent(
            type: 'array',
            items: new OA\Items(ref: new Model(type: AlbumDto::class, groups: ['full']))
        )
    )]

is not correct.

Please update the docs.

can you provide the correct version? I'm also struggling with this

This is the version I have added via composer. But the OA\JsonContent-Object has no property type which accepts string as value 🤷‍♂️

I just checked and the workign version for me is:

use Nelmio\ApiDocBundle\Annotation\Model;

    #[OA\Response(
        response: 200,
        description: "Returns the list of customers",
        content: new OA\JsonContent(
            type: "array",
            items: new OA\Items(ref: new Model(type: Customer::class))
        )
    )]

under

"nelmio/api-doc-bundle": "^4.29",

This is the version I have added via composer. But the OA\JsonContent-Object has no property type which accepts string as value 🤷‍♂️

swagger-php provides 2 JsonContent classes.
One for annotations

use OpenApi/Annotations as OA

And one for attributes (the one you are using)

use OpenApi/Attributes as OA

I think you are using the wrong namespace (and thus the wrong class), updating your import should fix this issue.