Skip to content

Preserve original input type information for external types #9152

@JoshLove-msft

Description

@JoshLove-msft

For the case of DFE in particular, we expect tsp like the following:

@doc("Expression model for DataFactory expressions")
model DfeExpressionModel {
  @doc("The type of expression")
  type: "Expression";
  @doc("The expression value")
  value: string;
}

// DataFactoryElement alternate type pattern
@alternateType({identity: "Azure.Core.Expressions.DataFactoryElement"}, "csharp")
union Dfe<T> {
  T,
  DfeExpressionModel
}

@doc("Model with DataFactoryElement properties")
model DataFactoryElementModel {
  @doc("String property with DFE pattern")
  stringProperty: Dfe<string>;

  @doc("Int property with DFE pattern")
  intProperty: Dfe<int32>;

  @doc("Bool property with DFE pattern")
  boolProperty: Dfe<boolean>;

  @doc("String array property with DFE pattern")
  stringArrayProperty: Dfe<string[]>;
}

Right now, the union is replaced in the C# emitter with an external type. We should preserve the original type and just include the external info as metadata on InputType the same way that TCGC does. This is needed for DFE as we need to be able to get the union variant that represents the generic argument. There may be similar scenarios for other alternate types so we should just preserve the original type.

Metadata

Metadata

Assignees

Labels

emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharp

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions