swagger-api / swagger-api/swagger-codegen-generators

duplicate fields are generated for @ starting properties

Open
#1,029 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

for :
"@type": { "type": "string" }

and :
"type": { "type": "string" },
result is
@JsonProperty("@type") private String type = null; @JsonProperty("type") private String type = null;
which makes impossible code to compile.

both :
<plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.4.26</version>

and https://editor.swagger.io/ behaves the same :(

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 the schema containing both "@type" and "type", using the swagger-codegen Maven plugin configuration shown. Trace how generated Java property names are derived and verify the result no longer declares duplicate fields while preserving both JSON properties. Add or update regression coverage if the generator's test suite has a matching location.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.