Numeric Field Name Validation in Patches

Published: August 18, 2025

v2025-08-18
Content Lake

Numeric Field Name Validation

Patch mutations now properly validate field names that start with digits, preventing silent failures and providing clear guidance on how to fix the issue.

If your patch operations use field names that start with a digit - like some UUIDs (7819f29-cd8e-438a-bf53-27953351677a), pure numbers (123), or other identifiers beginning with digits (9abc) - you'll now receive helpful error messages showing exactly how to use bracket notation to make them work: ['7819f29-cd8e-438a-bf53-27953351677a']. JSONPath requires this bracket notation for fields starting with digits to distinguish them from array indices.

This change eliminates frustrating debugging sessions where patches would silently fail or return confusing "field not present" errors, making your mutation operations more reliable and predictable with immediate, actionable feedback.

Breaking changes

To continue using the previous behavior, use an API version prior to 2025-08-18. Updating to 2025-08-18 or later will cause patch mutations with numeric field names to return validation errors instead of silently failing.

Examples

Before (API versions prior to 2025-08-18):

// This silently fails - field is not actually set 
patch.setIfMissing({  '7819f29-cd8e-438a-bf53-27953351677a': 0 })  

// This throws "Cannot increment because it is not present"
patch.inc({  '7819f29-cd8e-438a-bf53-27953351677a': 1 })

After (API version 2025-08-18 and later):

// This now returns a helpful error: 
// "Field path "7819f29-cd8e-438a-bf53-27953351677a" starts with a digit, which is not allowed. Use bracket notation instead: ['7819f29-cd8e-438a-bf53-27953351677a']" 
patch.setIfMissing({  '7819f29-cd8e-438a-bf53-27953351677a': 0 })  

// Correct usage with bracket notation: 
patch.setIfMissing({  "['7819f29-cd8e-438a-bf53-27953351677a']": 0 })

Related documentation