swagger-api / swagger-api/swagger-codegen

[java][jaxrs] codegen fails on nested lists trys to put generic in class name

Open
#5,327 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted Issue: Bug Server: Java
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

output code for list of list of double includes invalid java List<Double>.class
Note that a list of doubles is generated correctly but a list of list of doubles is not.

Swagger-codegen version

2.2.2

Swagger declaration file content or url
swagger: '2.0'

info:
  title: example
  version: "0"

paths:
  /go:
    get:
      responses:
        200:
          description: "success"
          schema:
            type: array
            items: 
              type: array
              items:
                type: number
                format: double

this outputs invalid java to src/gen/java/io/swagger/api/GoApi.java

Command line used for generation

swagger-codegen generate --lang jaxrs --library jersey2 -i nowork.yaml

Steps to reproduce

create a file called nowork.yaml with the text given.
run the command swagger-codegen generate --lang jaxrs --library jersey2 -i nowork.yaml from the directory containing nowork.yaml
observe the generated file src/gen/java/io/swagger/api/GoApi.java it contains the bad java code List<Double>.class

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with nowork.yaml using swagger-codegen generate --lang jaxrs --library jersey2 -i nowork.yaml, then inspect src/gen/java/io/swagger/api/GoApi.java. Trace the generated nested-list type handling that produces List<Double>.class; done means the generated Java is valid for the nested list schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.