google / google/gson

GSON ignoring kotlin data class null-safety and default value

Open
#1,657 4 comments 17 reactions 1 assignee Claimed by @eamonnmcmanus View on GitHub
kotlin
Dominant language
Java
Stars
24.2k
Forks
4.5k
Avg merge
6d 4h
Merged PRs (30d)
12

Description

This results in Gson creating data objects with possible null values for non-null variables in the following cases:
Any variable that is marked as non-null in the data class but is missing in the JSON
Any variable that is an Enum type and the value passed from the server doesn’t have a matching Enum value on the client

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.