microsoft / typespec

Home Page:https://typespec.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support decorating template properties

archerzz opened this issue · comments

Clear and concise description of the problem

This is derived from discussion in Azure/typespec-azure#959

User scenario is that the service has several models derived from a template Azure.ResourceManager.ProxyResource<T>:

model Addon is ProxyResource<AddonProperties>
...
model VirtualMachine is ProxyResource<VirtualMachineProperties>
...

ProxyResource<T> has a property named properties: T which the user wants to flatten for all those models. So they defined the following customization (https://github.com/Azure/azure-rest-api-specs/blob/1418642cf8a57954c781c26c759fd4aef39a1287/specification/vmware/Microsoft.AVS/client.tsp#L19):

@@flattenProperty(Azure.ResourceManager.ProxyResource.properties);

which unfortunately doesn't work.

If we allow decorating template properties, that would bring some benefits like people can batch decorate a group of models.

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

@archerzz can you describe a little more and give a repro, this works fine with other decorators
see playground

Hi @archerzz. Since there hasn't been recent engagement, we're going to close this out. Please feel free to reopen if you have any further questions or concerns.