OpenAPITools / OpenAPITools/openapi-generator
[BUG] ASPNETCORE Collection And ICollection - Missing using System.Collections.ObjectModel;
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
using 4.0.2
generating for aspnetcore
below are my settings
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.0.2</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.namespace}/bin/swagger/swagger.yaml</inputSpec>
<generatorName>aspnetcore</generatorName>
<output>./</output>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<skipValidateSpec>true</skipValidateSpec>
<apiPackage>${project.namespace}.Api</apiPackage>
<modelPackage>${project.namespace}.Model</modelPackage>
<configOptions>
<returnICollection>true</returnICollection>
<useCollection>true</useCollection>
<generateBody>false</generateBody>
<operationResultTask>true</operationResultTask>
<classModifier>abstract</classModifier>
<operationModifier>abstract</operationModifier>
<sourceFolder>./</sourceFolder>
<packageName>${project.namespace}</packageName>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
2 issues found
- useCollection property works but missing the using System.Collections.ObjectModel;
- returnICollection doesn't appear to work it still generates as Collection not ICollection
expect the using System.Collections.ObjectModel; statement to also be generated and placed at the top of class file
other nice to have please additional options if possible
- Dictionary as IDictionary
- List as IList
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 provided Maven plugin configuration and the aspnetcore generator, using the useCollection and returnICollection options. Inspect the generated class file and compare its collection types and using statements with the requested output. Done means the appropriate collection imports and configured interface types are generated consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100