When we unmarshal json, the undefined keys take zero values in structs. So, there is no way to differentiate between an undefined value and an actual zero value when it is passed in json in a PATCH request.
Example:
{
"active": false,
"text": "Lorem ipsum"
}
and
{
"text": "Lorem ipsum"
}
Structs of both these unmarshalled json objects will have active as false.
When we unmarshal json, the undefined keys take zero values in structs. So, there is no way to differentiate between an undefined value and an actual zero value when it is passed in json in a PATCH request. Example: { "active": false, "text": "Lorem ipsum" } and { "text": "Lorem ipsum" } Structs of both these unmarshalled json objects will have active as false.