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

@XmlElement not working correctly on Fields #502

Closed
sohailehmad opened this issue Mar 20, 2014 · 6 comments
Closed

@XmlElement not working correctly on Fields #502

sohailehmad opened this issue Mar 20, 2014 · 6 comments
Labels
Milestone

Comments

@sohailehmad
Copy link

If I use @XmlElementon a Filed, it will only work if Field name is same as provided in XmlElement e.g

@XmlRootElement(name = "Pet")
public class Pet {
  @XmlElement(name = "name")
  public String name;
}

But if field name is different from the one provided in XmlElement field will not appear in api docs

@XmlRootElement(name = "Pet")
public class Pet {
  @XmlElement(name = "pet_name")
  public String name;
}
@fehguy fehguy added the Bug label Mar 30, 2014
@kiriak7
Copy link

kiriak7 commented Apr 29, 2014

I have the same issue. I just want to clarify that the field appears in api docs, but with the wrong name ("name" instead of "pet_name").

@sohailehmad
Copy link
Author

@XmlElementon works fine on getter function. So make your field private and access it through getters and setters

@kiriak7
Copy link

kiriak7 commented Apr 30, 2014

You are right, @xmlelement does work. But @XmlAttribute doesn't.

@fehguy fehguy modified the milestone: v1.5.0 Sep 19, 2014
@fehguy fehguy modified the milestones: v1.3.12, v1.5.0 Dec 20, 2014
@fehguy
Copy link
Contributor

fehguy commented Dec 21, 2014

fixed in d9fafcd

@fehguy fehguy closed this as completed Dec 21, 2014
@feliperoos
Copy link

Hi Folks! Shouldn't this work on fields also? I'm pretty sure JAX-RS does not pose any restriction on the definition for XmlElement. Other than that, it makes difficult to have swagger working properly with project lombok.

@webron
Copy link
Contributor

webron commented Mar 11, 2016

@feliperoos you commented on an issue from over a year ago, which is not even relevant to the current stable version. If you have an issue with the 1.5.X versions, please open a new ticket and provide details so we can try and help. Keep in mind that by default the new swagger-core doesn't support JAXB annotations but the support can be added manually.

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

No branches or pull requests

5 participants