invalid-deserializeEmptyStringAsNull-target-type
@azure-tools/typespec-client-generator-core/invalid-deserializeEmptyStringAsNull-target-typeSeverity: error
This diagnostic is issued when @deserializeEmptyStringAsNull is applied to a property whose type is not string and is not a scalar derived from string.
Impact
Section titled “Impact”- Area: SDK deserialization customization. Blocks empty-string-to-null handling on non-string-like properties.
- Not affected: Other properties and the service payload schema are unchanged.
❌ Incorrect Usage
Section titled “❌ Incorrect Usage”model Widget { @deserializeEmptyStringAsNull count: int32; // property type is not `string` or string-derived}Diagnostic Message
Section titled “Diagnostic Message”TCGC reports:
@deserializeEmptyStringAsNull can only be applied to `ModelProperty` of type 'string' or a `Scalar` derived from 'string'.✅ How to Fix
Section titled “✅ How to Fix”Apply the decorator only to a string property or a property whose scalar type ultimately extends string.
model Widget { @deserializeEmptyStringAsNull name: string;}