Hi team
I'm experiencing an issue when generating Java client code from the Allegro OpenAPI spec using OpenAPI Generator v7.17.0.
Setup
My Maven plugin configuration:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.17.0</version>
<executions>
<execution>
<id>generate-allegro-api</id>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/allegro-swagger.yaml</inputSpec>
<generatorName>java</generatorName>
<output>${project.basedir}</output>
<library>restclient</library>
<apiPackage>com.allegroclient.api</apiPackage>
<modelPackage>com.allegroclient.model</modelPackage>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<useJakartaEe>true</useJakartaEe>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
<openApiNullable>false</openApiNullable>
<legacyDiscriminatorBehavior>false</legacyDiscriminatorBehavior>
<useOneOfInterfaces>true</useOneOfInterfaces>
</configOptions>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
</configuration>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
In the generated code, some polymorphic models using oneOf with a discriminator (e.g., TextSafetyInformation) generate an enum for the type property. This leads to Spring Boot 3.5.5 runtime
getType() in 'TextSafetyInformation' clashes with 'getType()' in the interface 'ProductSetElementSafetyInformationRequestSafetyInformation'; incompatible return type
I tried:
legacyDiscriminatorBehavior=true/false
useOneOfInterfaces=true
openApiNullable=false
…but the enum type is still generated and incompatible with interfaces.
Environment
OpenAPI Generator: 7.17.0
Spring Boot: 3.5.5
Java: 21
Ecample of openAPi file
https://developer.allegro.pl/swagger.yaml
or:
https://developer.allegro.pl/documentation
Hi team
I'm experiencing an issue when generating Java client code from the Allegro OpenAPI spec using OpenAPI Generator v7.17.0.
Setup
My Maven plugin configuration:
In the generated code, some polymorphic models using oneOf with a discriminator (e.g., TextSafetyInformation) generate an enum for the type property. This leads to Spring Boot 3.5.5 runtime
getType() in 'TextSafetyInformation' clashes with 'getType()' in the interface 'ProductSetElementSafetyInformationRequestSafetyInformation'; incompatible return typeI tried:
…but the enum type is still generated and incompatible with interfaces.
Environment
OpenAPI Generator: 7.17.0
Spring Boot: 3.5.5
Java: 21
Ecample of openAPi file
https://developer.allegro.pl/swagger.yaml
or:
https://developer.allegro.pl/documentation