Forum Discussion
ponelat
4 years agoStaff
So examples in responses are supported, but $refs _within_ examples are not allowed as it isn't possible to distinguish between the example itself and the special keywords (like $ref).
See bottom of the https://swagger.io/docs/specification/2-0/adding-examples/?sbsearch=Examples page.
However, as for examples in responses... here is a quick sample:
openapi: 3.0.3
info:
title: Examples
version: 1.2.3
description: Using examples with $refs in responses.
paths:
/foos:
get:
description: Get Foos
responses:
'200':
description: A list of Foos
content:
application/json:
examples:
FirstExample:
$ref: '#/components/examples/SomeExample'
components:
examples:
SomeExample:
value:
- one
- two
Related Content
Recent Discussions
- 4 days ago