OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I have a schema called Passenger as a part of my RequestBody, which has following example:
Passenger:
type: object
additionalProperties: false
description: |
Minimal specification of a passenger.
required:
- externalRef
- passengerType
properties:
externalRef:
description: |
A stable reference to a passenger from the caller system.
When received in the request, it must be returned in the response.
type: string
nullable: false
example: passenger1
passengerType:
$ref: '#/components/schemas/PassengerType'
dateOfBirth:
type: string
format: date
nullable: true
age:
description: |
Age of the passenger at the date of travel. Less stable than the date of birth.
type: integer
format: int32
minimum: 0
exclusiveMinimum: true
nullable: true
contactDetails:
$ref: '#/components/schemas/ContactDetails'
example:
externalRef: passenger1
passengerType: PERSON
dateOfBirth: 2001-01-01
contactDetails:
firstName: Name
lastName: Lastname
eMail: name@test.com
preferredLanguage: en
After generating endpoints, examples are nowhere to be found, and after calling /v3/api-docs I'm geeting this:
So example values for ContactDeatils are being taken from Warning part
Warning:
type: object
additionalProperties: false
description: |
This element can be used to pass non-blocking information or events.
It is inspired on the JSON Problem structure.
required:
- type
properties:
type:
description: |
An absolute URI that identifies the warning type. When dereferenced,
it SHOULD provide human-readable documentation for the problem type
(e.g., using HTML).
type: string
format: uri
nullable: false
default: 'about:blank'
example: https://example.com/warns/price-updated
detail:
description: |
A human readable explanation specific to this occurrence of the
warning.
type: string
nullable: true
example: The price of the given offer part has been updated during the booking operation
And in response from /v3/api-docs this looks like default example for all JsonNullableString:
"JsonNullableString": {
"type": "object",
"properties": {
"present": {
"type": "boolean"
}
},
"description": "A human readable explanation specific to this occurrence of the warning. ",
"example": "The price of the given offer part has been updated during the booking operation"
}
openapi-generator version
6.2.1
expected output
when checking my source yaml file, examples look like this:
Bug Report Checklist
Description
I have a schema called
Passenger
as a part of my RequestBody, which has following example:After generating endpoints, examples are nowhere to be found, and after calling /v3/api-docs I'm geeting this:
So example values for ContactDeatils are being taken from
Warning
partAnd in response from /v3/api-docs this looks like default example for all JsonNullableString:
openapi-generator version
6.2.1
expected output
when checking my source yaml file, examples look like this: