Open API 3.0-请求主体未显示在swagger文档页面中

时间:2019-11-24 16:35:36

标签: node.js swagger openapi

我正在通过下载服务器here的源代码来使用Open API 3.0。

  • 访问链接
  • 在菜单栏上选择生成服务器
  • 选择 nodejs服务器

我只需按照README.md中的说明通过执行npm start来运行服务器。

之后,我访问URL http://localhost:8080/docs。但是,招摇页面中没有请求正文。更具体地说,您可以在图片中看到以下内容

enter image description here

此api的yaml文件中的代码如下

/pet:
  put:
    tags:
    - pet
    summary: Update an existing pet
    operationId: updatePet
    requestBody:
      description: Pet object that needs to be added to the store
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Pet'
        application/xml:
          schema:
            $ref: '#/components/schemas/Pet'
      required: true
    responses:
      "400":
        description: Invalid ID supplied
        content: {}
      "404":
        description: Pet not found
        content: {}
      "405":
        description: Validation exception
        content: {}
    security:
    - petstore_auth:
      - write:pets
      - read:pets
    x-codegen-request-body-name: body
    x-swagger-router-controller: Pet

另一方面,https://editor.swagger.io/中显示的内容有所不同,但是yaml文件完全相同。

enter image description here 我如何像https://editor.swagger.io/一样在本地计算机上显示请求正文

0 个答案:

没有答案