找不到 Nelmio 4 安全定义索引

Nelmio 4 security definitions index not found

我尝试配置 nelmio/api-doc-bundle 为我的 Bearer 令牌使用授权 header。

我在nelmio_api_doc.yaml中这样配置

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

但是当我进入 ui 文档页面时,我得到了:

注意:未定义索引:securityDefinitions

有人知道如何解决吗?

它在版本 4 中已更改,请查看此文档 https://symfony.com/doc/4.x/bundles/NelmioApiDocBundle/index.html#using-the-bundle