Skip to content

Using oneOf to specify enum values for a property in schema doesn't generate the enums #15701

@amynguyen780

Description

@amynguyen780
Description

I want to be able to specify a description for each enum value for an enum property that is used in a schema for an object, and I had seen here that it was possible to do via oneOf for the enum property. However, following that, I wasn't able to get any enums generated.

openapi-generator version

6.5.0

OpenAPI declaration file content or url
  schemas:
    TargetBase:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        test_enum:
          type: string
          oneOf:
            - enum: [TEST1]
              description: testing 1
            - enum: [TEST2]
              description: testing 2
            - enum: [TEST3]
              description: testing 3
      description: The base entity that target objects extend from.
Command line used for generation

mvn generate-sources

Steps to reproduce

After specifying enum as in the above example, run mvn generate-sources in order to generate the OAS Java code. If you view the generated file for the enum object, you will see no enums defined.

Related issues/PRs

OAI/OpenAPI-Specification#348 (comment)

Suggest a fix/enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions