FasterXML / FasterXML/jackson-annotations

Rename ambiguous `JsonProperty.Access.*` constants

未關閉
#233 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
1.1k
分支
342
平均合併
8 小時 53 分鐘
30 天內合併 PR
2

描述

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)

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。