如何在Swagger UI中删除“示例”组合框或更改其文本?

时间:2019-07-11 08:12:26

标签: swagger-ui openapi

我在Swagger UI上遇到问题,它显示一个空白的“示例”组合框(在下图标记为黄色),看起来不太好。有没有办法将其删除或将其文本更改为有用的内容?

Swagger 3.0 Petstore example

我尝试添加example标记,但是它不起作用。操作定义如下:

post:
  tags:
  - pet
  summary: Add a new pet to the store
  operationId: addPet
  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:
    405:
      description: Invalid input
      content: {}
  security:
  - petstore_auth:
    - write:pets
    - read:pets

1 个答案:

答案 0 :(得分:1)

Swagger UI v 3.23.0和Swagger Editor 3.6.31中的

This is a bug。在修复之前,您可以使用早期版本的UI或编辑器。