-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When the JSON-API server receives a PATCH request, the model converter will automatically fill in the existing payload attributes into the provided model instance. As a result, we have a blank model instance where only those properties are filled, which have been provided with values in the request body.
A PATCH request is designed to modify an existing document partially, but here comes the problem: When trying to work with the converted payload model instance further, we don't know if a property with a null value should be persisted to be null or if it just wasn't set in the request body. We loose the necessarry request payload context. Therefor we require an optional model method, which will provide the information, whether a certain property is intended to be null, because it needs to be "removed", or if it's just blank because it has not been provided. So something equivalent to the php isset function.