问题
When I add examples into my swagger doc and test it on the swagger editor, then it never shows anywhere. Could someone give me an example of where multiple examples are actually showing anywhere?
Here is an example of how multiple examples are added:
it is from: https://swagger.io/docs/specification/adding-examples/
Here is an example of yaml that does not display any examples
on the online swagger editor:
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
回答1:
Multiple examples
are displayed in Swagger UI 3.23.0+ and Swagger Editor 3.6.21+:
In older versions, you can use a single example
as a workaround:
parameters:
- name: Client
in: query
required: true
example: '50' # <-----
schema:
type: string
来源:https://stackoverflow.com/questions/52595690/swagger-multiple-examples-not-showing