You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand how custom examples work. I have a route: /collection/type/{typeName}
which returns all of the values per the typeName (JSON). I would like to add an example in the 200 status or in the body so the input is user and the output is all of the users (JSON's Array). I didn't see an option of "input" in the docs. Also, I don't want it to be custom (written by me), I want it to fetch the data by itself without adding a $ref. For example if the input is user then it will do the GET request and get the data. Is it something that is possible using Swagger?
The text was updated successfully, but these errors were encountered:
OAS3 examples keyword can use externalValue to specify an URL containing an external example value. But Swagger UI does not support externalValue yet, this is tracked in #5433.
openapi: 3.0.3info:
title: externalValue exampleversion: 1.0.0servers:
- url: https://myserver.compaths:
/collection/type/{typeName}:
get:
parameters:
- in: pathname: typeNamerequired: trueschema:
type: stringresponses:
'200':
description: OKcontent:
application/json:
schema: {}examples:
userTypes:
description: The example value should be fetched from this URLexternalValue: https://myserver.com/collection/type/user
Q&A (please complete the following information)
How can we help?
I'm trying to understand how custom examples work. I have a route:
/collection/type/{typeName}
which returns all of the values per the
typeName
(JSON). I would like to add an example in the200
status or in the body so the input isuser
and the output is all of the users (JSON's Array). I didn't see an option of "input" in the docs. Also, I don't want it to be custom (written by me), I want it to fetch the data by itself without adding a$ref
. For example if the input isuser
then it will do the GET request and get the data. Is it something that is possible using Swagger?The text was updated successfully, but these errors were encountered: