NelmioApiDoc v3 / Swagger - 多个 API 文档
NelmioApiDoc v3 / Swagger - multiple API docs
NelmioApiDoc v2 允许使用多个 views
参数,因此我可以隐藏一些端点并将它们呈现在不同的 URL
https://symfony.com/doc/current/bundles/NelmioApiDocBundle/multiple-api-doc.html
是否可以在使用 Swagger 的 NelmioApiDoc v3 中实现?
我正在使用 Symfony 3.3
您要查找的内容现在在 NelmioApiDoc v3 中似乎被称为 "Areas"。
由于此功能,您可以定义区域,每个区域将生成不同的文档:
您只需在 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 }
您可以在 this doc 上阅读它。
NelmioApiDoc v2 允许使用多个 views
参数,因此我可以隐藏一些端点并将它们呈现在不同的 URL
https://symfony.com/doc/current/bundles/NelmioApiDocBundle/multiple-api-doc.html
是否可以在使用 Swagger 的 NelmioApiDoc v3 中实现?
我正在使用 Symfony 3.3
您要查找的内容现在在 NelmioApiDoc v3 中似乎被称为 "Areas"。 由于此功能,您可以定义区域,每个区域将生成不同的文档:
您只需在 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 }
您可以在 this doc 上阅读它。