JsonPatch remove command when value changed from null to undefined

40 views Asked by At

Server returns data that may include optional text values. In the original object they appear as null. I have dynamic form (using React + Ant Design) which allows user to add more of these fields. When I save the form, the form returns the field as undefined if the field was never touched. Now json patch is created and it includes a remove command for the field because it changed from null to undefined.

In the future, I plan to add a changelog to record what changes have been made and due to the unwanted patch command, the changelog might include unwanted lines. How can I avoid these unwanted commands? There's no way I would start to map all data to convert all null to undefined.

0

There are 0 answers