-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi-generator version
7.3.0
OpenAPI declaration file content or url
openapi: 3.0.3
components:
schemas:
TransportLocation:
example:
iataCode: ZRH
locationType: AIRPORT
properties:
iataCode:
description: IATA code for the location
example: ZRH
type: string
locationType:
description: Type of the transport location
enum:
- UNKNOWN
- AIRPORT
- TRAIN_STATION
- BUS_STATION
- AREA
example: AIRPORT
type: string
required:
- iataCode
- locationType
type: objectGeneration Details
When generating code based on the provided yaml, there is no for the any enumeration property defined within an object.
Taking locationType as an example, I could solve it by first declaring an Enum object and then adding its reference to the TransportLocation, solution below:
TransportLocationType:
description: Type of the transport location
enum:
- UNKNOWN
- AIRPORT
- TRAIN_STATION
- BUS_STATION
- AREA
type: string
example: AIRPORT
TransportLocation:
example:
iataCode: ZRH
locationType: AIRPORT
properties:
iataCode:
description: IATA code for the location
example: ZRH
type: string
locationType:
$ref: '#/components/schemas/TransportLocationType'
required:
- iataCode
- locationType
type: object
Only after that the properly EnumNameSerializer/Converted were created:
Steps to reproduce
openapi-generator generate -c <yaml file path>
Related issues/PRs
Didn't found any one.
Reactions are currently unavailable

