Request: @SerializedName for alternate only
- Dominant language
- Java
- Stars
- 24.2k
- Forks
- 4.5k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 12
Description
We're trying to use `@SerializedName` with only `alternate`. I noticed it requires both arguments (`value`-for both directions and `alternate`-for deserialization)
But here's the rub. We use gson for two different use cases in our app. For one, we use the snake_case naming strategy and for the other we use the camelCase strategy. But if we set `@SerializedName(value="someKey", alternate={"alt1", "alt2"})` our snake_case serializer breaks.
So my ask is could we have a way to provide `alternate` without setting `value`?
Maybe a new annotation for alternates?
Or even change the implementation so that when `value == null`, it will fall back to default behavior.
Thoughts?
Contributor guide
Assessment
This issue has not been assessed yet.