external-type-on-model-property
@azure-tools/typespec-client-generator-core/external-type-on-model-propertySeverity: warning
This diagnostic is issued when @alternateType with external type information is applied directly to a model property.
Impact
Section titled “Impact”- Area: External alternate-type mapping. Generation continues, but property-level external type information is not applied to SDK type substitution.
- Not affected: The model property remains in the service schema with its original TypeSpec type.
❌ Incorrect Usage
Section titled “❌ Incorrect Usage”model Widget { @alternateType( // external alternate type is applied to a model property { identity: "external.WidgetName", }, "python" ) name: string;}Diagnostic Message
Section titled “Diagnostic Message”TCGC reports:
@alternateType with external type information cannot be applied to model properties. Please apply it to the type definition itself (Scalar, Model, Enum, or Union) instead.✅ How to Fix
Section titled “✅ How to Fix”Apply the external alternate type to the scalar, model, enum, or union definition instead of to a model property:
@alternateType( { identity: "external.WidgetName", }, "python")scalar WidgetName extends string;
model Widget { name: WidgetName;}Suppression
Section titled “Suppression”This diagnostic should not be suppressed. Fix the external type usage so it is applied correctly.