swagger-api / swagger-api/swagger-codegen

[Jaxrs-cxf] Jaxrs-cxf inheritance is not working through discriminator

Open
#6,434 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

@Jsontypeinfo and @Jsonsubtypes annotations should be normally generated while using discriminator. But they are not getting generated while using Jaxrs-cxf.

Does this mean Jaxrs-cxf doesn't support discriminator way of inheritance for the POJO classes?

Swagger-codegen version

v2.2.3

Not a regression - Missing functionality

Steps to reproduce

Use jaxrs/cxf with discriminator and see if @JsonTypeInfo and @JsonSubTypes are generated.
Expected: @JsonTypeInfo and @JsonSubTypes tags are present in superclass
Actual: Annotations are missing

Related issues/PRs
Suggest a fix/enhancement

I checked the code and I don't see {{#discriminator}} in the pojo.mustache of JavaJaxRS/cxf .

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

Start with the Java Jaxrs-cxf pojo.mustache template, where the issue reports that discriminator handling is absent. Reproduce generation with a discriminator and inheritance, then verify that the superclass output contains @JsonTypeInfo and @JsonSubTypes annotations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.