jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Inverse access of `@JsonProperty(access=)` so it can work differently on server side and client side

Open qianlong opened this issue 4 years ago • 1 comments

@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 avatar Nov 20 '20 15:11 qianlong

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 avatar Nov 20 '20 18:11 cowtowncoder