Skip to content

Commit e2ad537

Browse files
pshao25Pan ShaoAlitzelMendezJiaqiZhang-Devgrizzlytheodore
authored
Migrate compute latest swagger to TypeSpec (#32748)
* Migrate compute latest swagger to TypeSpec * update * update * update * Some fix * update * small fixes: supress some warnings and update readme.md * add go-emitter option * Fix duplicate issue * remove go-emitter option * update * Addressing more differences in spec * Addressing more differences in spec * fix INVALID_FORMAT examples * fix INVALID_FORMAT examples * modelvalidation Missing_resource_ID examples fixes * Revert pageable change * Fix examples * change back default tag to package-2024-11-04 for validation * Revert some change to make API back again * Fix bump changes * update * Fix format * Upgrade to tag 2025-02-01 * Addressing differences in Gallery * Addressing Gallery diff & after merge main fixes * Update compute after fixing clouderror * Fix format * Clean Pull Request after merge with main * Address compute difference * Address compute differences - subresource only * Fix examples and invalid format Current test were not the 11-01 test, updating them * Add type and name as example check this / verify with Pan if this breaks SDK * Change done to match with test / Check with Pan SDK validation * Model validation fixes - etag - diskControllerType from array enum to enum (string type) * Add new path - fix previous not matching path * revert changes to compute 2024-07-01 * update readme to use 2024-11-01/ComputeRP.json * remove reference to 2024/07/01/ComputeRP.json on readme * Delete ComputeRP.json file * Fix avocado * Feedback with Theo: remove pattern, remove max and add x-ms-identifiers * Compute: Add description for enums * Fix x-ms-idenfitirs inconsistency with compute rp * update * update * readme.java.md * readme.go.md * readme.go.md * Compute feedback * Fix prettier * fix prettier in examples * Update Gallery examples to examples from 2024-03-03 * Fix new gallery examples * Update examples in Gallery.Management * Update operations from ErrorResponse to CloudErrror for list operations on computeRP * fix readme.go.md * Update * Update names * update readme.go.md * update readme.go.md * Remove useless model * Fix model validation after name changes * Fix tests in compute.management tsp * Update cloudService.json * revert * Add newline * update capitalization * Typespec udpate after release (#35125) * Update to latest tsp version && address vmName issue * fix format --------- Co-authored-by: Pan Shao <[email protected]> Co-authored-by: AlitzelMendez <[email protected]> Co-authored-by: JiaqiZhang-Dev <[email protected]> Co-authored-by: Alitzel Mendez <[email protected]> Co-authored-by: Theodore Chang <[email protected]> Co-authored-by: xiaofeicao <[email protected]>
1 parent f182a76 commit e2ad537

File tree

1,431 files changed

+119557
-37256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,431 files changed

+119557
-37256
lines changed

specification/compute/Common.Management/legacy.tsp

Lines changed: 414 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import "./models.tsp";
2+
3+
@service({
4+
title: "Custom.Common.Types",
5+
})
6+
namespace Microsoft.Compute;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import "./models.tsp";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
4+
using Azure.ResourceManager.Legacy;
5+
6+
namespace Microsoft.Compute;
7+
8+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
9+
@@externalTypeRef(ApiError,
10+
"../../../common-types/v1/common.json#/definitions/ApiError"
11+
);
12+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
13+
@@externalTypeRef(ApiErrorBase,
14+
"../../../common-types/v1/common.json#/definitions/ApiErrorBase"
15+
);
16+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
17+
@@externalTypeRef(CloudError,
18+
"../../../common-types/v1/common.json#/definitions/CloudError"
19+
);
20+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
21+
@@externalTypeRef(InnerError,
22+
"../../../common-types/v1/common.json#/definitions/InnerError"
23+
);
24+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
25+
@@externalTypeRef(SubResource,
26+
"../../../common-types/v1/common.json#/definitions/SubResource"
27+
);
28+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
29+
@@externalTypeRef(SubResourceReadOnly,
30+
"../../../common-types/v1/common.json#/definitions/SubResourceReadOnly"
31+
);
32+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
33+
@@externalTypeRef(ExtendedLocation,
34+
"../../../common-types/v1/common.json#/definitions/ExtendedLocation"
35+
);
36+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
37+
@@externalTypeRef(ExtendedLocationTypes,
38+
"../../../common-types/v1/common.json#/definitions/ExtendedLocationTypes"
39+
);
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
import "@typespec/http";
2+
import "@typespec/openapi";
3+
import "@typespec/rest";
4+
5+
using Http;
6+
using OpenAPI;
7+
using TypeSpec.Rest;
8+
9+
namespace Microsoft.Compute;
10+
11+
/* Provides the standard '$expand' query parameter. */
12+
model $ExpandQueryParameter<T = string> {
13+
/** The expand expression to apply on the operation. */
14+
@query("$expand")
15+
$expand?: T;
16+
}
17+
18+
/**
19+
* Api error.
20+
*/
21+
model ApiError {
22+
/**
23+
* The Api error details
24+
*/
25+
@Azure.ResourceManager.identifiers(#["message", "target"])
26+
details?: ApiErrorBase[];
27+
28+
/**
29+
* The Api inner error
30+
*/
31+
innererror?: InnerError;
32+
33+
/**
34+
* The error code.
35+
*/
36+
code?: string;
37+
38+
/**
39+
* The target of the particular error.
40+
*/
41+
target?: string;
42+
43+
/**
44+
* The error message.
45+
*/
46+
message?: string;
47+
}
48+
49+
/**
50+
* Api error base.
51+
*/
52+
model ApiErrorBase {
53+
/**
54+
* The error code.
55+
*/
56+
code?: string;
57+
58+
/**
59+
* The target of the particular error.
60+
*/
61+
target?: string;
62+
63+
/**
64+
* The error message.
65+
*/
66+
message?: string;
67+
}
68+
69+
/**
70+
* Inner error details.
71+
*/
72+
model InnerError {
73+
/**
74+
* The exception type.
75+
*/
76+
exceptiontype?: string;
77+
78+
/**
79+
* The internal error message or exception dump.
80+
*/
81+
errordetail?: string;
82+
}
83+
84+
/**
85+
* An error response from the Compute service.
86+
*/
87+
@error
88+
model CloudError {
89+
/**
90+
* Api error.
91+
*/
92+
error?: ApiError;
93+
}
94+
95+
/**
96+
* The Resource model definition with location property as optional.
97+
*/
98+
model ResourceWithOptionalLocation {
99+
/**
100+
* Resource location
101+
*/
102+
location?: string;
103+
104+
/**
105+
* Resource Id
106+
*/
107+
@visibility(Lifecycle.Read)
108+
id?: string;
109+
110+
/**
111+
* Resource name
112+
*/
113+
@visibility(Lifecycle.Read)
114+
name?: string;
115+
116+
/**
117+
* Resource type
118+
*/
119+
@visibility(Lifecycle.Read)
120+
type?: string;
121+
122+
/**
123+
* Resource tags
124+
*/
125+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility"
126+
tags?: Record<string>;
127+
}
128+
129+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "For backward compatibility"
130+
model SubResource {
131+
/**
132+
* Resource Id
133+
*/
134+
id?: string;
135+
}
136+
137+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "For backward compatibility"
138+
model SubResourceReadOnly {
139+
/**
140+
* Resource Id
141+
*/
142+
@visibility(Lifecycle.Read)
143+
id?: Azure.Core.armResourceIdentifier;
144+
}
145+
146+
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "For backward compatibility"
147+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
148+
@doc("Concrete proxy resource types can be created by aliasing this type using a specific property type.")
149+
@Http.Private.includeInapplicableMetadataInPayload(false)
150+
@Azure.ResourceManager.Legacy.customAzureResource
151+
model ProxySubResourceReadOnly<Properties extends {}>
152+
extends SubResourceReadOnly {
153+
@doc("The resource-specific properties for this resource.")
154+
properties?: Properties;
155+
156+
/**
157+
* The name of the parent resource.
158+
*/
159+
@path
160+
@visibility(Lifecycle.Read)
161+
@segment("parents")
162+
parentName: string;
163+
}
164+
165+
/**
166+
* The complex type of the extended location.
167+
*/
168+
model ExtendedLocation {
169+
/**
170+
* The name of the extended location.
171+
*/
172+
name?: string;
173+
174+
/**
175+
* The type of the extended location.
176+
*/
177+
type?: ExtendedLocationTypes;
178+
}
179+
180+
/**
181+
* The type of extendedLocation.
182+
*/
183+
union ExtendedLocationTypes {
184+
string,
185+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "For backward compatibility"
186+
EdgeZone: "EdgeZone",
187+
}

0 commit comments

Comments
 (0)