Skip to content

[BUG] maven-plugin - ignoreAnyOfInEnum works with embedded enum but not with ref #21105

Open
@bligny

Description

@bligny

Config & version

<plugin>
  <groupId>org.openapitools</groupId>
  <artifactId>openapi-generator-maven-plugin</artifactId>
  <version>7.12.0</version>
  <executions>
      <execution>
          <goals>
              <goal>generate</goal>
          </goals>
          <configuration>              
              <generatorName>java</generatorName>
              <library>restclient</library>              
              ...
              <configOptions>                  
                  <ignoreAnyOfInEnum>true</ignoreAnyOfInEnum>                 
              </configOptions>
          </configuration>
      </execution>
  </executions>
</plugin>

The processing of the ignoreAnyOfInEnum param behaves differently depending on how the schema is modeled.

Problem description

The following DOES work:

"type": {
  "anyOf": [
    {
      "type": "string",
      "enum": [
        "A",
        "B",
        "C"              
      ],
      "description": "Predefined types"
    },
    {
      "type": "string",
      "pattern": "^/other.*",
      "description": "Non-standard types"
    }
  ]
}

But this one does NOT (which expresses the exact same thing):

"type": {
  "anyOf": [
    {
      "$ref": "#/components/schemas/TypeStandard"
    },
    {
      "$ref": "#/components/schemas/TypeOther"
    }
  ]
},
"TypeStandard": {
  "type": "string",
  "enum": [
    "A",
    "B",
    "C"
  ],
  "description": "Predefined types"
},
"TypeOther": {
  "type": "string",
  "pattern": "^/other.*",
  "description": "Non-standard types"
},   

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions