-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discrepancy of generation from tsp and swagger for resource name property #378
Comments
One real issue from service team: Azure/azure-rest-api-specs#27565 (comment) |
@tadelesh I don't think the referenced spec is actually blocked by this, because it cannot use the resource templates in any case, due to the resource type inheriance form TrackedResource or ProxyResource. The only way to represent this API without breaks is to use a custom-defined resource type, as shown in this playground Note that this will be a problem for new specs that were originally introduced in TypeSpec, or any specs that use resource types that directly inherit from ProxyResource of TrackedResource (a small list). This problem should be addressed by this issue: https://github.com/Azure/typespec-azure-pr/issues/3873 |
Then how should emitter deal with the |
Pending design issue: https://github.com/Azure/typespec-azure-pr/issues/3873 |
#661 Merged |
cc: @pshao25 pay attention to this change. convertor need to adopt the change. |
Will do after it releases. |
Current tsp, we define a resource
name
property in the final resource model, not inherit it from the base resource model. This will cause thename
property in the generated code for JS and Python to be breaking.For example, a
FooResource
defined as:typespec-azure/packages/typespec-azure-resource-manager/test/resource.test.ts
Lines 49 to 56 in a156385
It is sourced from
TrackedResource
template:typespec-azure/packages/typespec-azure-resource-manager/lib/models.tsp
Lines 17 to 25 in a156385
Which is derived from
TrackedResourceBase
model:typespec-azure/packages/typespec-azure-resource-manager/lib/arm.foundations.tsp
Lines 49 to 55 in a156385
Which is derived from
ArmResource
model:typespec-azure/packages/typespec-azure-resource-manager/lib/arm.foundations.tsp
Lines 22 to 37 in a156385
You could see
name
property is defined inFooResource
, not inArmResource
.But with swagger common-types, the name is defined in the root
Resource
model:https://github.com/Azure/azure-rest-api-specs/blob/84849e5293de3a8e01cbdde13b2d7086d3fb34d6/specification/common-types/resource-management/v5/types.json#L9-L37
The text was updated successfully, but these errors were encountered: