symfonynelmioapidocbundle

Nelmio 4 security definitions index not found


I try to configure nelmio/api-doc-bundle to use Authorization header for my Bearer token.

I configure it in nelmio_api_doc.yaml like this

nelmio_api_doc:
    documentation:
        info:
            title: title
            version: 1.0.0
        securityDefinitions:
            Bearer:
                type: apiKey
                description: 'jwt from oauth prefixed by `Bearer`'
                name: Authorization
                in: header
        security:
            -   Bearer: []
    areas: # to filter documented areas
        path_patterns:
            - ^/api(?!/doc$|/doc.json$) # Accepts routes under /api except /api/doc and /api/doc.json

But when i got to the ui doc page I got :

Notice: Undefined index: securityDefinitions

Did someone know how to fix it ?


Solution

  • It was changed in version 4, check this docs https://symfony.com/doc/4.x/bundles/NelmioApiDocBundle/index.html#using-the-bundle