1

NelmioApiDoc v2 允许使用多个views参数,因此我可以隐藏一些端点并将它们呈现在不同的 URL 上

https://symfony.com/doc/current/bundles/NelmioApiDocBundle/multiple-api-doc.html

是否可以在使用 Swagger 的 NelmioApiDoc v3 中做到这一点?

我正在使用 Symfony 3.3

4

1 回答 1

1

您正在寻找的似乎现在在 NelmioApiDoc v3 中被称为“区域”。借助此功能,您可以定义每个区域都会生成不同的文档:

您只需在 config.yml 中定义这些区域:

nelmio_api_doc:
    areas:
        default:
            path_patterns: [ ^/api ]
        custom:
            path_patterns: [ ^/custom ]
        another_custom:
            path_patterns: [ ^/anothercustom ]

然后你需要更新你的 routing.yml 文件:

app.swagger_ui:
    path: /api/doc/{area}
    methods: GET
    defaults: { _controller: nelmio_api_doc.controller.swagger_ui, area: default }

你可以在这个文档上阅读它。

于 2018-02-01T12:53:24.967 回答