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

[FR] Add support for @JsonAutoDetect #1284

Open
mazenkhalil opened this issue Oct 14, 2022 · 2 comments
Open

[FR] Add support for @JsonAutoDetect #1284

mazenkhalil opened this issue Oct 14, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@mazenkhalil
Copy link

mazenkhalil commented Oct 14, 2022

The current implementation for schema generation doesn't support @com.fasterxml.jackson.annotation.JsonAutoDetect class annotation. Where the Schema get generated regardless of the access visibility rules for fields and/or methods.

e.g. The following entity is configured with two visibility rules:

  1. Fields: Ignored regardless of the access modifier unless stated otherwise (e.g. @JsonProperty)
  2. Getters: Only public getters are visible
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
public class Entity {

    @JsonProperty("property_1")
    public String property1;

    @JsonIgnore
    public String property2;

    public String property3;

    private String property4;

    public String getProperty5() {
        return "";
    }

    private String getProperty6() {
        return "";
    }
}

Generated Schema

Entity {
    property_1	string //As expected
                       //property2 ignored As expected
    property3	string //To be ignored
    property4	string //To be ignored
    property5	string //As expected
    property6	string //To be ignored
}

Expected Behavior
The generated Schema to be aligned with the access visibility rules for fields and/or methods as defined in @JsonAutoDetect.

@MikeEdgar MikeEdgar added the enhancement New feature or request label Oct 14, 2022
@mazenkhalil
Copy link
Author

@MikeEdgar Any plan/timeline for getting this resolved?

@MikeEdgar
Copy link
Member

@mazenkhalil , not yet. I'll probably be focused on some of the bugs first. As always, PRs are welcome if you are willing to try it!

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

No branches or pull requests

2 participants