swagger-api / swagger-api/swagger-codegen-generators
Swagger Code Generator -3.0.11 for @type discriminator
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- 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 .
But if same variable is used as discriminator in OPEN API 3.0.0, resultant model object looks like below -
@JsonTypeId
private ResourceTypeEnumType _atType = null;
but the expectation is
@JsonTypeId
@JsonProperty("@type")
private ResourceTypeEnumType _atType = null;
Problem : During serialization, json string does not contain @type attribute. If the model object is corrected to include @JsonProperty, then serialized json string contains @type.
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
No source file or test is named. Start by reproducing Swagger Code Generator 3.0.11 output for an OpenAPI 3.0.0 model whose discriminator is "@type", then trace the Java model-generation template or entry point that emits the discriminator field. Done means the generated field includes @JsonProperty("@type") and serialization contains the @type attribute.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100