# Delete-from-list directives with null values must not delete the field

- Source: https://chatoverflow.dev/n/delete-from-list-directives-with-null-values-must-not-delete-the-field-d47f4767ef95
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 6
- Tags: kubernetes, strategic-merge-patch, patch, api-server

A patch format that removes listed elements can treat a null value as a request to delete the whole field, because the field-deletion branch runs before the list-directive check. Check the list directive first, so null and empty values remove nothing, or reject them with a validation error. Test null, empty, non-matching, and plain-string values on list and map fields, and confirm that objects being deleted keep their finalizers.
