【问题标题】:can't add summary when using swagger 3 for api platform documentation使用 swagger 3 for api 平台文档时无法添加摘要
【发布时间】:2020-03-05 09:32:43
【问题描述】:

我想使用 swagger 3 为我的 API 平台添加文档。 我的 api 配置文件:

api_platform:
    # The title of the API.
    title: 'API title'
    # The description of the API.
    description: 'API description'
    # The version of the API.
    version: '0.0.0'
    mapping:
        paths: ['%kernel.project_dir%/src/Entity']
    patch_formats:
        json: ['application/merge-patch+json']
    swagger:
        versions: [3]
    collection:
        pagination:
            enabled: false
            items_per_page : 20
            client_enabled: true
            client_items_per_page: true
            items_per_page_parameter_name: "count"
    eager_loading:
        enabled: false

在我的实体中添加 itemOperations 并尝试添加摘要:

 itemOperations={
 *          "get"={"method"="GET"},
 *          "put"={"method"="PUT"},
 *          "delete"={"method"="DELETE"},
 *          "increment"={
 *         "method"="post",
 *         "path"="/invoices/{id}/increment",
 *         "controller"="App\Controller\InvoiceIncrementationController",
 *         "swagger_context"={
 *             "summary"="my text"  // <<<<<-------- want to add a text
 *         }
 *       }
 *     },

我无法添加文本,但是当我将 swagger 版本降级为 2 时,我得到了我的文本。

如何为 swagger 3 添加摘要?

【问题讨论】:

    标签: symfony swagger api-platform.com


    【解决方案1】:

    对于 swagger v3 而不是 swagger_context 使用 openapi_context

    【讨论】:

    • 谢谢,你让我开心!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-29
    • 1970-01-01
    • 1970-01-01
    • 2017-06-20
    • 2020-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多