swagger-api / swagger-api/swagger-codegen
[jaxrs-cxf-client] incorrect List of Lists return type in Api
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I have a swagger.json file with a response schema of string[].
I'm expecting this to produce a method return type of List of String.
Instead I'm seeing List of List of String
Swagger-codegen version
2.2.2
Swagger declaration file content or url
"/v1/comments/categories" : {
"get" : {
"tags" : [ "comments" ],
"summary" : "Returns all comment categories.",
"description" : "",
"operationId" : "getCategories_1",
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "array",
"items" : {
"type" : "string"
}
}
}
}
}
}
Produces
@Api(value = "/", description = "")
public interface CommentsApi {
@GET
@Path("/v1/comments/categories")
@ApiOperation(value = "Returns all comment categories.", tags={ })
public List<List<String>> getCategories1();
...
expected:
@Path("/")
@Api(value = "/", description = "")
public interface CommentsApi {
@GET
@Path("/v1/comments/categories")
@ApiOperation(value = "Returns all comment categories.", tags={ })
public List<String> getCategories1();
...
Command line used for generation
Maven.
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.2</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>swagger.json</inputSpec>
<language>jaxrs-cxf-client</language>
<configOptions>
<dateLibrary>joda</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Steps to reproduce
Run maven against the above json.
Related issues
Searched, but nothing jumped out at me. I'm not really familiar with the project though.
Suggest a Fix
Unsure... Will poke a bit at it.
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
Start with the jaxrs-cxf-client generator and reproduce the issue by running Maven against the provided swagger.json response schema. Compare the generated CommentsApi getCategories1 return type with the expected List; done means the array-of-string schema no longer produces List<List>.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100