You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docker run --rm --workdir /github/workspace -v $(pwd):/github/workspace openapitools/openapi-generator-cli:v6.2.1 generate -g spring -o /github/workspace/spring-client -i /github/workspace/contract.yml -p groupId=co.test,basePackage=co.test.v2.server.config,basePackage=co.test.v2.server,apiPackage=co.test.v2.server,invokerPackage=co.test.v2.server.invoker,modelPackage=co.test.v2.server.models,library=spring-boot,artifactId=test-v2-server,documentationProvider=none,useSwaggerUI=false,interfaceOnly=true,snapshotVersion=true
Steps to reproduce
Save the contract above into file contract.yml
Run the docker command above
open spring-client/src/main/java/co/test/v2/server/models/TransactionEvent.java
Verify that @JsonValue is used in code but it is not imported
Related issues/PRs
There was similar issue before #11323 And I can confirm that this is similar nature issue because hasEnums is not set during generation of that class...
Suggest a fix
I dont have suggestion for a fix, but tmp workaround is to add this code on top of pojo.mustache:
Unfortunately without the discriminator property the inheritance is ignored. So we either get a missing import or the class isn't extending the class as intended.
Can confirm, seeing this issue as well. Any update when we might see a fix here? Like @Sax388 mentioned, we effectively cannot have inheritance at the moment otherwise the generated code doesn't even compile.
Bug Report Checklist
Description
Missing import means that code does not compile...
openapi-generator version
6.3.0-snapshot, 6.2.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
contract.yml
spring-client/src/main/java/co/test/v2/server/models/TransactionEvent.java
@JsonValue
is used in code but it is not importedRelated issues/PRs
There was similar issue before #11323 And I can confirm that this is similar nature issue because
hasEnums
is not set during generation of that class...Suggest a fix
I dont have suggestion for a fix, but tmp workaround is to add this code on top of
pojo.mustache
:As you can see I am adding import only when the
hasEnums
is false... Because otherwise we are risking that we will have same import twice...Important debugging note:
If you remove discriminator from the contract above, the generation is working fine...
The text was updated successfully, but these errors were encountered: