Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
8 stars 29 forks source link

Referencing to a type in resource manager library should not generate new type in swagger #1061

Closed pshao25 closed 1 week ago

pshao25 commented 2 weeks ago

In the playground, we take CheckNameAvailabilityReason as example, which comes from Azure.ResourceManager.CommonTypes.

reason?: Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason;

It is generated as type Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason in swagger as showed in that playground.

For .net, for this generated swagger we will generate model with name AzureResourceManagerCommonTypesCheckNameAvailabilityReason, which is expected to be CheckNameAvailabilityReason.

So I'm thinking the expected swagger model might be a reference to common type like:

"reason": {
    "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/CheckNameAvailabilityReason"
    "description": "The reason why the given name is not available."
  },

Same to other types.

allenjzhang commented 1 week ago

Dup of #995 , scheduled for next sprint

allenjzhang commented 1 week ago

995