swagger-api / swagger-api/swagger-codegen

Codegen does not generate generic List

Open
#473 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug Swagger-Parser
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Hi,

In my api model I have:
@JsonProperty("repriceItems") private List<RepriceItem> items;
swagger json (I think correct):
"repriceItems": { "items": { "type": "RepriceItem" }, "required": false, "type": "List" }

But when I run codegen for Java or Android, I get:
private List repriceItems = null;
instead of
private List<RepriceItem> repriceItems = null;

I'm using codegen v 2.1.2-M1.

Is it a bug or do I something wrong?

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 Java and Android codegen output from the supplied model and Swagger JSON using codegen v2.1.2-M1. Start by tracing the Java/Android type handling and templates that produce the repriceItems field, then verify the generated declaration preserves RepriceItem and add or update regression coverage if the project provides it.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.