OpenAPITools / OpenAPITools/openapi-generator
[BUG] Can't use Set instead of List on Java generation ( Set is not imported )
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Hello, i'm using the latest snapshot of openapi-generator ( 5.0.0-SNAPSHOT ).
Here is the maven plugin is use :
<execution>
<id>Generate Spring</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/swagger/api.yml</inputSpec>
<output>${project.build.directory}/generated-sources/openapi/java</output>
<generatorName>spring</generatorName>
<instantiationTypes>array=HashSet</instantiationTypes>
<typeMappings>array=Set</typeMappings>
<importMappings>Set=java.util.Set,HashSet=java.util.HashSet</importMappings>
</configuration>
</execution>
I tried <importMappings>Set=java.util.Set</importMappings> ( without HashSet ) too.
The code is referencing Set but doesn't import the class.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the Maven plugin configuration in the report, using the spring generator, Set type mapping, and import mappings. Inspect the Java/Spring generator's type and import handling, then verify that generated code using Set includes java.util.Set and compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100