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

Missing JSON properties with @XmlType(propOrder = { .. }) and @XmlAttribute #565

Closed
sfussenegger opened this issue Dec 12, 2016 · 4 comments
Labels
Milestone

Comments

@sfussenegger
Copy link

I'm using JAXB and Jackson modules (honorJaxb="true") and it seems that some - not all - properties with @XmlAttribute are missing from the example and properties thable in the documentation if @XmlType(propOrder = { .. }) is specified

@stoicflame stoicflame added the bug label Dec 13, 2016
@stoicflame stoicflame added this to the 2.8.0 milestone Dec 13, 2016
@stoicflame
Copy link
Owner

I'll take a look.

If you can provide more details about the circumstances, that would be helpful.

@sfussenegger
Copy link
Author

see molindo/enunciate-565-example

run mvn package and compare target/docs/apidocs/json_Tweet.html with target/docs/apidocs/xml_ns0_tweet.html


XML properties:

name data type type namespace min/max occurs constraints description
date dateTime attribute 1/1
id string attribute 1/1
user string attribute 1/1
message string element 1/1 required
url URL element 0/1

JSON properties

name data type description
date number
message string
url string

Tweet class:

@XmlRootElement
@XmlType(propOrder = {"message", "url"})
public class Tweet {

    private String id;

    private String user;

    private Date date;

    private String message;
    
    private URL url;

    @XmlAttribute(required = true)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @XmlAttribute(required = true)
    public String getUser() {
        return user;
    }

    @XmlAttribute
    public void setUser(String user) {
        this.user = user;
    }

    @XmlAttribute(required = true)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @XmlElement(required = true)
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public URL getUrl() {
        return url;
    }

    public void setUrl(URL url) {
        this.url = url;
    }
}

@sfussenegger
Copy link
Author

a viable workaround is to add all attributes to propOrder

@stoicflame
Copy link
Owner

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

2 participants