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

Rename ambiguous JsonProperty.Access.* constants #233

Open
overheadhunter opened this issue Jun 29, 2023 · 1 comment
Open

Rename ambiguous JsonProperty.Access.* constants #233

overheadhunter opened this issue Jun 29, 2023 · 1 comment

Comments

@overheadhunter
Copy link

I'd like to request a rather trivial change, however it is API-breaking, so I fully understand this can only be done for the next major version:

Today, I got confused by @JsonProperty(value = "...", access = JsonProperty.Access.WRITE_ONLY). I'm in a context, where I read from and write to a json file. So "write" means "serialize" and "read" means "deserialize" in my context.

However, the above constants WRITE_ONLY and READ_ONLY are named from the object mapper's perspective writing values to the java object ("setting") or reading values from java objects ("getting").

In other words: The constant names are highly dependent from the perspective, to say the least. Therefore I'm suggesting to rename them as follows:

old new
AUTO AUTO
READ_ONLY SERIALIZE_ONLY
WRITE_ONLY DESERIALIZE_ONLY
READ_WRITE ANY

(Jackson 2.15.2)

@cowtowncoder
Copy link
Member

I''ll keep this as an open request but will note that chances of it getting done ever are slim. The reason being that there are no plans to change compatibility of annotations between 2.x and 3.x, meaning that intent is to -- unlike b/w 1.x and 2.x -- to have same set of annotations, packages and semantics working across Jackson 2.x and 3.x.

This is not to say I disagree with assessment that existing names were not chosen well (my fault). Just that from practical POV the gain is unlikely worth the breakage.

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

No branches or pull requests

2 participants