There are scenarios where tracking the source model of anonymous models is beneficial. For instance, in TypeScript code generation, this feature would enable us to map serializer/deserializer types between RLC (Rest Level Client) and Modular. This functionality is crucial for bridging gaps between RLC and Modular types.
Example
Consider the following TypeSpec model:
model Foo {
bar: {
baz: string;
}
}
With the ability to track the source model, we could implement the following TypeScript code:
declare function deserializeFooBar(input: FooRest["bar"]): BarModel;
Here, BarModel is generated from TCGC, but there is no equivalent interface in RLC as it doesn't generate anonymous models.
[X] Check that this issue is about the Azure libraries for typespec. For feature request in the typespec language or core libraries file it in the TypeSpec repo
could you clarify the source meaning? for example, if anonymous model is in parameter, what should the source model be? other cases are model property, return type, etc.
Clear and concise description of the problem
There are scenarios where tracking the source model of anonymous models is beneficial. For instance, in TypeScript code generation, this feature would enable us to map serializer/deserializer types between RLC (Rest Level Client) and Modular. This functionality is crucial for bridging gaps between RLC and Modular types.
Example Consider the following TypeSpec model:
With the ability to track the source model, we could implement the following TypeScript code:
Here, BarModel is generated from TCGC, but there is no equivalent interface in RLC as it doesn't generate anonymous models.
Checklist