microprofile-extensions / openapi-ext

Some extensions for MicroProfile OpenAPI
Apache License 2.0
22 stars 13 forks source link

@XmlTransient is ignored #31

Closed rsoika closed 4 years ago

rsoika commented 4 years ago

I try to define a @XmlRootElement with some transient fields like this one:

@XmlRootElement(name = "config")
public class XMLConfig implements Serializable {

    @XmlTransient
    private static final long serialVersionUID = 1L;

    @XmlTransient
    private String test;

    private String target;
    private String user;

    public XMLConfig() {
    }
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    public java.lang.String getTarget() {
        return target;
    }
    public void setTarget(String target) {
        this.target = target;
    }

}

But the @XmlTransient seems to be ignored and the opanapi-ui shows the following data schema:

{
  "serialVersionUID": 0,
  "test": "string",
  "target": "string",
  "user": "string",
}

I expected that the fields 'test' and 'serialVersinUID' are hidden.

I also tested this using the @XmlAccessorType(XmlAccessType.PROPERTY) but with even no better result.

I am testing this with payara-micro and

    <dependency>
        <groupId>org.microprofile-ext.openapi-ext</groupId>
        <artifactId>openapi-ui</artifactId>
        <version>1.1.3</version>
    </dependency>
phillip-kruger commented 4 years ago

How does the yaml or json looks like ? The UI Will only display what is in the actual schema, and that gets generated with MicroProfile open api. Maybe the problem is there ?

rsoika commented 4 years ago

I do not have a extra json file to configure openapi. But when I look into the outcome of openapi I got also the fields I did not expect. So it is a problem from openapi itself.

openapi: 3.0.0
info:
  title: Deployed Resources
  version: 1.0.0
servers:
- url: http://localhost:8080
....
......
components:
  schemas:
    XMLConfig:
      type: object
      properties:
        serialVersionUID:
          type: number
        target:
          type: string
        user:
          type: string

thanks. I will close this issue.