swagger-api / swagger-api/swagger-codegen
[SPRING] Swagger Code Generator -3.0.11 for @baseType property
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
In Swagger Code Generator 3.0.11, model generation is corrected to handle the variables that start with '@' symbol . During serialization, json string contains additional attribute "atBaseType" along with "@baseType"
Json response -
{"atBaseType": "PhysicalResource",
"@baseType": "PhysicalResource"}
#####YAML
yaml.zip
Suggest a fix/enhancement
This can be corrected by modifying the Setter and Getter of Generated Model. Model generated with SPRING library using Swagger Code Gen 3.0.11 for @baseType property is
@JsonProperty("@baseType")
private String _atBaseType = null;
public String getAtBaseType() {
return _atBaseType;
}
public void setAtBaseType(String _atBaseType) {
this._atBaseType = _atBaseType;
}
If this is corrected to below code then additional attribute is not shown -
public String get_atBaseType() {
return _atBaseType;
}
public void set_atBaseType(String _atBaseType) {
this._atBaseType = _atBaseType;
}
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 attached yaml.zip and reproduce generation with Swagger Code Generator 3.0.11 using the Spring library. Inspect the generated model's @baseType accessors and the Spring generator templates that produce them; done means serialization contains only @baseType, not an additional atBaseType property.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100