Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bligny opened this issue Apr 17, 2025 · 0 comments

Comments

@bligny
Copy link

bligny commented Apr 17, 2025

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"
},   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant