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 not sure if this is a common use case but wanted to ask to see if this would be a useful feature. In my OpenAPI spec I have multiple example requests and corresponding responses for them. Would it make sense to match these by name so that a request which matches an example in the spec will look for a corresponding example response and return that? From my perspective it would be a better option than passing a Prefer header to specify the desired response. Looking for feedback on this idea and if its popular I can attempt a PR.
The text was updated successfully, but these errors were encountered:
If you need an example, something like this is what I had in mind
openapi: 3.0.0info:
version: 1.0.0title: Example APIdescription: Example API for GH Issuepaths:
/widgets:
post:
description: Create a New WidgetrequestBody:
description: Creates and persists a new widgetcontent:
application/json:
schema:
type: objectproperties:
name:
type: stringcolor:
type: stringrequired:
- nameexamples:
successful:
value:
bin: Fredpcn: greenfailure:
value:
color: blueresponses:
'200':
description: Successfully predictedcontent:
application/json; charset=UTF-8:
schema:
type: objectproperties:
id:
type: numbername:
type: numbercolor:
type: numbersuccess:
type: booleanmessage:
type: stringexamples:
successful:
value:
id: 42cost: 99.99name: Fredcolor: greensuccess: truefailure:
value:
success: false,message: name is a required property of a new widget
So if I send a request with params that match the successful example params it would be great for the successful example response to be sent back. And same for the failure examples.
I'm not sure if this is a common use case but wanted to ask to see if this would be a useful feature. In my OpenAPI spec I have multiple example requests and corresponding responses for them. Would it make sense to match these by name so that a request which matches an example in the spec will look for a corresponding example response and return that? From my perspective it would be a better option than passing a
Prefer
header to specify the desired response. Looking for feedback on this idea and if its popular I can attempt a PR.The text was updated successfully, but these errors were encountered: