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

Allow inverting @JsonProperty(access=) with MapperFeature.INVERSE_READ_WRITE_ACCESS so it can work differently on server side and client side #2951

Closed
qianlong opened this issue Nov 20, 2020 · 3 comments · Fixed by #4761
Labels
2.19 Issues planned at 2.19 or later
Milestone

Comments

@qianlong
Copy link

@JsonProperty's access mode should be inversed on server side and client side when both sides are sharing the same module class.

when using access = READ_ONLY with @JsonProperty, on the server side, that means property need to be serialized but can't be deserialized. but on the client side, the same property should be able to be deserialized but not to be serialized.

Is it good to have an out-of-box feature to do this inversion?

@qianlong qianlong added the to-evaluate Issue that has been received but not yet evaluated label Nov 20, 2020
@cowtowncoder
Copy link
Member

cowtowncoder commented Nov 20, 2020

Nothing to support it out-of-the-box, but you should be able to sub-class JacksonAnnotationIntrospector and override relevant methods to change the logic as necessary?

Or, alternatively, use mix-in annotations (but that may be more work for larger sets of types).

@cowtowncoder cowtowncoder removed the to-evaluate Issue that has been received but not yet evaluated label Nov 25, 2020
@cowtowncoder cowtowncoder changed the title inverse access of @JsonProperty so it can work differently on server side and client side inverse access of @JsonProperty(access=) so it can work differently on server side and client side Dec 2, 2020
@cowtowncoder cowtowncoder changed the title inverse access of @JsonProperty(access=) so it can work differently on server side and client side Inverse access of @JsonProperty(access=) so it can work differently on server side and client side Dec 2, 2020
@cowtowncoder cowtowncoder added 2.14 and removed 2.13 labels Jul 15, 2021
@cowtowncoder cowtowncoder removed the 2.14 label Mar 2, 2024
@cowtowncoder cowtowncoder changed the title Inverse access of @JsonProperty(access=) so it can work differently on server side and client side Allow inverting @JsonProperty(access=) so it can work differently on server side and client side Oct 28, 2024
@cowtowncoder cowtowncoder changed the title Allow inverting @JsonProperty(access=) so it can work differently on server side and client side Allow inverting @JsonProperty(access=) with MapperFeature.INVERSE_READ_WRITE_ACCESS so it can work differently on server side and client side Oct 28, 2024
@cowtowncoder
Copy link
Member

Implemented by addition of MapperFeature.INVERSE_READ_WRITE_ACCESS; will be included in 2.19.0.

cowtowncoder added a commit that referenced this issue Oct 28, 2024
cowtowncoder added a commit that referenced this issue Oct 28, 2024
@cowtowncoder cowtowncoder added the 2.19 Issues planned at 2.19 or later label Oct 28, 2024
@cowtowncoder cowtowncoder added this to the 2.19.0 milestone Oct 28, 2024
@cowtowncoder
Copy link
Member

Implemented for 2.19.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.19 Issues planned at 2.19 or later
Projects
None yet
2 participants