当我将示例添加到swagger文档中并在swagger编辑器中对其进行测试时,它永远不会显示在任何地方。有人可以给我一个例子,说明多个示例实际上在哪里显示吗?
它来自:https://swagger.io/docs/specification/adding-examples/
以下是yaml的示例,它在在线swagger编辑器上不显示任何examples
:
openapi: 3.0.0
info:
title: Some API
version: 1.0.0
paths:
/logon:
get:
summary: Login user
tags:
- '/logon'
parameters:
- name: Client
in: query
required: true
examples:
zero:
value: '0'
summary: A sample limit value
max:
value: '50'
summary: A sample limit value
schema:
type: string
responses:
'200':
description: Success response
答案 0 :(得分:3)
Swagger UI和Swagger编辑器当前不支持多个examples
。您可以按照this issue进行更新。
您现在可以使用example
(单数):
parameters:
- name: Client
in: query
required: true
example: '50' # <-----
schema:
type: string