-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
In https://github.com/Azure/azure-sdk-for-net/blob/main/eng/packages/http-client-csharp/generator/Azure.Generator/src/AzureTypeFactory.cs#L66, we need to handle InputUnionType that has a variant type of InputExternalType where the identity is "Azure.Core.Expressions.DataFactoryElement" in a special way. The logic should be that we create a generic type DataFactoryElement<T> where T is given by the other variant in the union. If there is more than one variant we should just log a warning and not apply this specialized logic.
We should update our test spec https://github.com/Azure/azure-sdk-for-net/blob/main/eng/packages/http-client-csharp/generator/TestProjects/Local/Basic-TypeSpec/Basic-TypeSpec.tsp
This shows the full set of supported T values https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryElementJsonConverter.cs
include uses of this pattern. Here is the tsp:
union Dfe<T> {
T,
DfeModel,
}
model DfeModel {
kind: "Expression";
value: string;
}
/** A widget. */
@resource("widgets")
model Widget {
/** The widget name. */
@key("widgetName")
@visibility(Lifecycle.Read)
name: string;
fooString: Dfe<string>;
fooInt: Dfe<int>;
fooModel: Dfe<SomeModel>;
fooList: Dfe<string[]>;
/** The widget color. */
color: WidgetColor;
/** The ID of the widget's manufacturer. */
manufacturerId: string;