Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][CXF] Some names of properties of JSON objects do not match the definition in the YAML #6693

Closed
gustavoapaz opened this issue Oct 16, 2017 · 1 comment · Fixed by #6710

Comments

@gustavoapaz
Copy link
Contributor

Description

For some names used to define Data types properties in a YAML, the JSON objects that the Java CXF Server expects and/or produces do not match the definition in the YAML.

Swagger-codegen version

2.3.0

Swagger declaration file content or url

For example an attribute defined in the YAML like this:

      EX_TYPE:
        type: "integer"

Generates the following Java server code:

public Integer getEXTYPE() {

This causes that the object corresponds to another JSON representation rather than the one intended.

Intended JSON:

EX_TYPE: 1

Obtained JSON:

EXTYPE: 1
Command line used for generation

..

Steps to reproduce

..

Related issues/PRs

..

Suggest a fix/enhancement

The CXF generation template for Data types could add the JsonProperty anotation to include the real name of the property.

By adding the following line to the pojo.mustache of JavaJaxRS/cxf

@JsonProperty("{{name}}")

The resulting Java code works without the above mentioned issue:

@JsonProperty("EX_TYPE")
public Integer getEXTYPE() {
@gustavoapaz
Copy link
Contributor Author

Here is the change that I propose: gustavoapaz@d9eb9c7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant