swagger-api / swagger-api/swagger-codegen

[jaxrs-resteasy-eap/java] with "withXml" not generating annotations for XML

Open
#11,732 1 comment 4 reactions 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

Hi,

we have an API which supports both xml and json - however only the json annotations are added.

https://github.com/t1m0/swagger-codegen-sample

Maybe our configuration is wrong? I wasn't able to find a related issue.

Currently:

@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaResteasyEapServerCodegen", date = "2022-03-01T10:36:29.360226+01:00[Europe/Berlin]")
public class SampleResponse   {
    private String message = null;
    
    @Schema(required = true, description = "")
    @JsonProperty("message")
    @NotNull
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    ...
}

Expected:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SampleResponse",propOrder = {"xml"})
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaResteasyEapServerCodegen", date = "2022-03-01T10:36:29.360226+01:00[Europe/Berlin]")
public class SampleResponse   {
    private String message = null;
    
    @XmlElement(required = true)
    @Schema(required = true, description = "")
    @JsonProperty("message")
    @NotNull
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    ...
}

Kind regards
Timo

Swagger-codegen version

Swagger Code Gen Version: 1.0.31
Swagger Code Gen Maven Plugin Version: 3.0.31

Sample project

https://github.com/t1m0/swagger-codegen-sample

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 reported output with the linked swagger-codegen-sample project and the JavaResteasyEapServerCodegen entry point named in the generated annotation. Compare the withXml configuration's generated Java output with the expected JAXB class and property annotations; done means XML annotations are emitted alongside the existing JSON annotations.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.