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 suppose there are multiple ways to define response examples, here I have a simple spec (example added with stoplight studio):
I'm referring to the examples inside responses.content.application/json.examples
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io/v2'
info:
description: 'This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.'
version: 1.0.0
title: OpenAPI Petstore
license:
name: Apache-2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: pet
description: Everything about your Pets
paths:
/pet:
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
examples:
example-1:
value:
id: 0
name: doggie
components:
schemas:
Pet:
title: a Pet
description: A pet for sale in the pet store
type: object
required:
- name
- photoUrls
properties:
id:
type: integer
format: int64
name:
type: string
example: doggie
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Working on the zapier generator came up the need to use response examples but actually are not supported by the generator.
Describe the solution you'd like
It would be great to have available in the templates the responses examples.
Describe alternatives you've considered
Additional context
There is already a TODO in the DefaultCodegen code -> https://github.com/OpenAPITools/openapi-generator/blob/fe78be405ed83c1d33045bc8bd5ea953f74a058f/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L4778C5-L4780C59
I suppose there are multiple ways to define response examples, here I have a simple spec (example added with stoplight studio):
I'm referring to the examples inside responses.content.application/json.examples
The text was updated successfully, but these errors were encountered: