vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
904 stars 57 forks source link

Missing type arguments for getter-based properties of the same type as their class #2757

Closed cromoteca closed 1 day ago

cromoteca commented 1 week ago

Describe the bug

When a property is exposed using getter and setter, and it is of the same type as the class it is in, the generated openapi.json does not contain its type arguments. The bug does not happen if the property is just a public field.

Expected-behavior

The type arguments should be exposed no matter how the property is defined.

Reproduction

Consider this entity:

public class MyEntity<T> {
    public MyEntity<T> good;
    private MyEntity<T> bad;

    public MyEntity<T> getBad() {
        return bad;
    }

    public void setBad(MyEntity<T> bad) {
        this.bad = bad;
    }
}

The type arguments for good will be generated as:

            "x-type-arguments" : {
              "allOf" : [
                {
                  "type" : "object",
                  "nullable" : true,
                  "x-type-variable" : "T"
                }
              ]
            }

while those for bad as "x-type-arguments" : { }.

System Info

Hilla 24.5.0.beta1