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
864 stars 58 forks source link

protected setter/getter is in the generated typescript #2587

Open jcgueriaud1 opened 6 days ago

jcgueriaud1 commented 6 days ago

Describe the bug

When I have this Java class:


public class Person {

    @NotNull
    private String fullName = "fullName";

    @NotNull
    private String descriptionPublic = "descriptionPublic";
    @NotNull
    private String descriptionProtected = "descriptionProtected";

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    protected String getDescriptionProtected() {
        return descriptionPublic;
    }

    protected void setDescriptionProtected(String descriptionProtected) {
        this.descriptionProtected = descriptionProtected;
    }

    public String getDescriptionPublic() {
        return descriptionPublic;
    }
}

The model generated in Typescript is containing descriptionProtected:

interface Person {
    fullName?: string;
    descriptionPublic?: string;
    descriptionProtected?: string;
}
export default Person;

The data sent doesn't contain the descriptionProtected

Expected-behavior

The model should be:

interface Person {
    fullName?: string;
    descriptionPublic?: string;
}
export default Person;

Note: If you remove the Setter then the model doesn't contain descriptionProtected.

Reproduction

https://github.com/jcgueriaud1/hilla-example-form/tree/bug-protected

Go to the home page and see the data in the copilot log (the data is ok).

Go to the Person.ts and see the descriptionProtected

System Info

Vaadin 24.4.4