Skip to content

Commit ffb4495

Browse files
authored
[Microsoft.Marketplace] - Fixing documentation errors (#38765)
Fixing typespec extension issues and migration to attribute spreading as per Typespec best practices
1 parent 5cf8492 commit ffb4495

File tree

2 files changed

+483
-42
lines changed
  • specification/marketplacecatalog

2 files changed

+483
-42
lines changed

specification/marketplacecatalog/Products.Management/product.tsp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ using Azure.ResourceManager;
88
namespace Microsoft.Marketplace;
99

1010
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Read-only metadata resource."
11-
@doc("Returns a subset of Product attributes")
12-
model ProductSummary {
11+
@doc("Base model containing common product attributes shared between ProductSummary and ProductDetails")
12+
model ProductBase {
1313
@doc("Product display name")
1414
displayName?: string;
1515

@@ -87,10 +87,6 @@ model ProductSummary {
8787
@doc("Total number of ratings for the offer")
8888
ratingCount?: int32;
8989

90-
@doc("Full set of plan/SKU attributes")
91-
@identifiers(#[])
92-
plans?: PlanSummary[];
93-
9490
@doc("Maps to the list of compatible products")
9591
supportedProducts?: string[];
9692

@@ -124,9 +120,20 @@ model ProductSummary {
124120
}
125121

126122
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Read-only metadata resource."
127-
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "This inheritance is intentional for extending ProductSummary with additional details"
128-
@doc("Summary description of the product")
129-
model ProductDetails extends ProductSummary {
123+
@doc("Returns a subset of Product attributes")
124+
model ProductSummary {
125+
...ProductBase;
126+
127+
@doc("Full set of plan/SKU attributes")
128+
@identifiers(#[])
129+
plans?: PlanSummary[];
130+
}
131+
132+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Read-only metadata resource."
133+
@doc("Returns the full set of Product attributes")
134+
model ProductDetails {
135+
...ProductBase;
136+
130137
@doc("List of product videos")
131138
@identifiers(#[])
132139
videos?: ProductVideo[];
@@ -211,12 +218,8 @@ model ProductDetails extends ProductSummary {
211218
@identifiers(#[])
212219
artifacts?: Artifact[];
213220

214-
// Override properties that differ from base class
215221
@doc("Full set of plan/SKU attributes")
216222
plans?: PlanDetails[];
217-
218-
@doc("The unique id of the product")
219-
productId: string;
220223
}
221224

222225
@doc("Returns a subset of Plan attributes")
@@ -282,9 +285,10 @@ model PlanSummary {
282285
hasRi?: boolean;
283286
}
284287

285-
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "This inheritance is intentional for extending PlanSummary with additional details"
286-
@doc("Returns a subset of Plan attributes")
287-
model PlanDetails extends PlanSummary {
288+
@doc("Returns the full set of Plan attributes")
289+
model PlanDetails {
290+
...PlanSummary;
291+
288292
@doc("The id")
289293
id?: string;
290294

0 commit comments

Comments
 (0)