Skip to content
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

[Java] Fix compilation error for a Map<String, Set<InnerEnum>> due to incompatible types #19401

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Bragolgirith
Copy link

@Bragolgirith Bragolgirith commented Aug 20, 2024

… incompatible types.

Fixes #19393.

@Bragolgirith Bragolgirith changed the title [Java] Fix compilation error for a Map<String, List<InnerEnum>> due to ... [Java] Fix compilation error for a Map<String, Set<InnerEnum>> due to ... Aug 20, 2024
@Bragolgirith Bragolgirith force-pushed the java-fix-compilation-for-map-of-collection-of-enum branch from 25ee253 to 940cab5 Compare August 24, 2024 06:35
@Bragolgirith Bragolgirith force-pushed the java-fix-compilation-for-map-of-collection-of-enum branch from 940cab5 to d7d5713 Compare August 24, 2024 06:56
@wing328 wing328 changed the title [Java] Fix compilation error for a Map<String, Set<InnerEnum>> due to ... [Java] Fix compilation error for a Map<String, Set<InnerEnum>> due to incompatible types Aug 28, 2024
enum:
- DEVELOPER
- TESTER
- OWNER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did a test with this spec but still got errors:

[ERROR] C:\Users\wing3\AppData\Local\Temp\java-enum\src\main\java\org\openapitools\client\model\Employee.java:[118,9] error: enum InnerEnum is already defined in class Employee
[ERROR] C:\Users\wing3\AppData\Local\Temp\java-enum\src\main\java\org\openapitools\client\JSON.java:[49,7] error: duplicate class: org.openapitools.client.JSON

can you please take a look?

command:

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/issue_19393_map_of_inner_enum.yaml -o /tmp/java-enum/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry about that!

The errors seem to be due to a different bug where the same name (InnerEnum) gets generated for multiple enums within the same schema.

I've now updated the test spec to use two different schemas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][JAVA] Compilation error for a Map<String, Set<InnerEnum>> due to incompatible types
2 participants