Currently, the handling of None values in PATCH requests is inconsistent across different parts of the codebase. In some instances, when no mask is provided, None values are filtered out, while in others, such as the Pool model, all values (including None) are validated and persisted if the payload is valid. The objective of this work item is to standardize PATCH request behaviour regarding None values:
When a mask is provided, use the values as specified by the mask.
When no mask is provided, ensure the payload is validated independently as a fully-formed database entity, allowing for explicit setting of fields to None.
Database Calls
Avoid making database calls solely to check for existence; instead, delegate this responsibility to the database itself during the primary operation.
Use case/motivation
A standardized approach for PATCH endpoints is needed.
Description
None Values
Currently, the handling of
None
values inPATCH
requests is inconsistent across different parts of the codebase. In some instances, when no mask is provided, None values are filtered out, while in others, such as thePool
model, all values (including None) are validated and persisted if the payload is valid. The objective of this work item is to standardizePATCH
request behaviour regarding None values:Database Calls
Avoid making database calls solely to check for existence; instead, delegate this responsibility to the database itself during the primary operation.
Use case/motivation
A standardized approach for PATCH endpoints is needed.
Related issues
Relates to: #42370 Follow Up of: #43102
Are you willing to submit a PR?
Code of Conduct