@azure-tools/typespec-ts 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/dist/src/modular/buildCodeModel.d.ts.map +1 -1
- package/dist/src/modular/buildCodeModel.js +52 -31
- package/dist/src/modular/buildCodeModel.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +3 -2
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +61 -52
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +2 -0
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/modularCodeModel.d.ts +1 -1
- package/dist/src/modular/modularCodeModel.d.ts.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +22 -22
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +50 -50
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +11 -11
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +11 -11
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.js +11 -11
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.js +11 -11
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.js +8 -8
- package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +12 -12
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/namespaceUtils.d.ts +1 -1
- package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
- package/dist/src/utils/namespaceUtils.js +3 -1
- package/dist/src/utils/namespaceUtils.js.map +1 -1
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +27 -27
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -18
- package/src/modular/buildCodeModel.ts +75 -30
- package/src/modular/helpers/operationHelpers.ts +70 -49
- package/src/modular/helpers/typeHelpers.ts +3 -0
- package/src/modular/modularCodeModel.ts +2 -1
- package/src/transform/transformApiVersionInfo.ts +30 -30
- package/src/transform/transformHelperFunctionDetails.ts +51 -51
- package/src/transform/transformParameters.ts +11 -10
- package/src/transform/transformPaths.ts +11 -10
- package/src/transform/transformResponses.ts +10 -10
- package/src/transform/transformSchemas.ts +10 -10
- package/src/transform/transformTelemetryInfo.ts +10 -10
- package/src/transform/transfromRLCOptions.ts +11 -11
- package/src/utils/namespaceUtils.ts +6 -2
- package/src/utils/operationUtil.ts +25 -26
|
@@ -57,9 +57,38 @@ function getOperationApiVersion(
|
|
|
57
57
|
program: Program,
|
|
58
58
|
dpgContext: SdkContext
|
|
59
59
|
): ApiVersionInfo | undefined {
|
|
60
|
-
const operationGroups = listOperationGroups(dpgContext, client);
|
|
61
60
|
const apiVersionTypes = new Set<string>();
|
|
62
61
|
const locations = new Set<ApiVersionPosition>();
|
|
62
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
63
|
+
for (const clientOp of clientOperations) {
|
|
64
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
65
|
+
// ignore overload base operation
|
|
66
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const params = route.parameters.parameters.filter(
|
|
70
|
+
(p) =>
|
|
71
|
+
(p.type === "query" || p.type === "path") && isApiVersion(dpgContext, p)
|
|
72
|
+
);
|
|
73
|
+
params.map((p) => {
|
|
74
|
+
const type = getSchemaForType(
|
|
75
|
+
dpgContext,
|
|
76
|
+
p.param.type,
|
|
77
|
+
[SchemaContext.Exception, SchemaContext.Input],
|
|
78
|
+
false,
|
|
79
|
+
p.param
|
|
80
|
+
);
|
|
81
|
+
if (p.type !== "header") {
|
|
82
|
+
locations.add(p.type);
|
|
83
|
+
}
|
|
84
|
+
const typeString = JSON.stringify(trimUsage(type));
|
|
85
|
+
apiVersionTypes.add(typeString);
|
|
86
|
+
});
|
|
87
|
+
if (apiVersionTypes.size > 1) {
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
63
92
|
for (const operationGroup of operationGroups) {
|
|
64
93
|
const operations = listOperationsInOperationGroup(
|
|
65
94
|
dpgContext,
|
|
@@ -96,35 +125,6 @@ function getOperationApiVersion(
|
|
|
96
125
|
}
|
|
97
126
|
}
|
|
98
127
|
}
|
|
99
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
100
|
-
for (const clientOp of clientOperations) {
|
|
101
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
102
|
-
// ignore overload base operation
|
|
103
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
const params = route.parameters.parameters.filter(
|
|
107
|
-
(p) =>
|
|
108
|
-
(p.type === "query" || p.type === "path") && isApiVersion(dpgContext, p)
|
|
109
|
-
);
|
|
110
|
-
params.map((p) => {
|
|
111
|
-
const type = getSchemaForType(
|
|
112
|
-
dpgContext,
|
|
113
|
-
p.param.type,
|
|
114
|
-
[SchemaContext.Exception, SchemaContext.Input],
|
|
115
|
-
false,
|
|
116
|
-
p.param
|
|
117
|
-
);
|
|
118
|
-
if (p.type !== "header") {
|
|
119
|
-
locations.add(p.type);
|
|
120
|
-
}
|
|
121
|
-
const typeString = JSON.stringify(trimUsage(type));
|
|
122
|
-
apiVersionTypes.add(typeString);
|
|
123
|
-
});
|
|
124
|
-
if (apiVersionTypes.size > 1) {
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
128
|
// If no api-version parameter defined return directly
|
|
129
129
|
if (apiVersionTypes.size === 0) {
|
|
130
130
|
return;
|
|
@@ -50,7 +50,21 @@ export function transformHelperFunctionDetails(
|
|
|
50
50
|
}
|
|
51
51
|
// TODO: Remove this when @pageable is finally removed.
|
|
52
52
|
const nextLinks = new Set<string>();
|
|
53
|
-
const
|
|
53
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
54
|
+
for (const clientOp of clientOperations) {
|
|
55
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
56
|
+
// ignore overload base operation
|
|
57
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (getPageable(program, route.operation)) {
|
|
61
|
+
const nextLinkName = getPageable(program, route.operation) || "nextLink";
|
|
62
|
+
if (nextLinkName) {
|
|
63
|
+
nextLinks.add(nextLinkName);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
54
68
|
for (const operationGroup of operationGroups) {
|
|
55
69
|
const operations = listOperationsInOperationGroup(
|
|
56
70
|
dpgContext,
|
|
@@ -71,20 +85,6 @@ export function transformHelperFunctionDetails(
|
|
|
71
85
|
}
|
|
72
86
|
}
|
|
73
87
|
}
|
|
74
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
75
|
-
for (const clientOp of clientOperations) {
|
|
76
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
77
|
-
// ignore overload base operation
|
|
78
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (getPageable(program, route.operation)) {
|
|
82
|
-
const nextLinkName = getPageable(program, route.operation) || "nextLink";
|
|
83
|
-
if (nextLinkName) {
|
|
84
|
-
nextLinks.add(nextLinkName);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
88
|
if (nextLinks.size === 0) {
|
|
89
89
|
return {
|
|
90
90
|
...annotationDetails,
|
|
@@ -123,7 +123,16 @@ function extractPageDetailFromCore(
|
|
|
123
123
|
// Add default values
|
|
124
124
|
nextLinks.add("nextLink");
|
|
125
125
|
itemNames.add("value");
|
|
126
|
-
const
|
|
126
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
127
|
+
for (const clientOp of clientOperations) {
|
|
128
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
129
|
+
// ignore overload base operation
|
|
130
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
extractPageDetailFromCoreForRoute(route);
|
|
134
|
+
}
|
|
135
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
127
136
|
for (const operationGroup of operationGroups) {
|
|
128
137
|
const operations = listOperationsInOperationGroup(
|
|
129
138
|
dpgContext,
|
|
@@ -138,15 +147,6 @@ function extractPageDetailFromCore(
|
|
|
138
147
|
extractPageDetailFromCoreForRoute(route);
|
|
139
148
|
}
|
|
140
149
|
}
|
|
141
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
142
|
-
for (const clientOp of clientOperations) {
|
|
143
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
144
|
-
// ignore overload base operation
|
|
145
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
extractPageDetailFromCoreForRoute(route);
|
|
149
|
-
}
|
|
150
150
|
|
|
151
151
|
function extractPageDetailFromCoreForRoute(route: HttpOperation) {
|
|
152
152
|
for (const response of route.responses) {
|
|
@@ -188,7 +188,32 @@ function extractSpecialSerializeInfo(
|
|
|
188
188
|
let hasTsvCollection = false;
|
|
189
189
|
let hasSsvCollection = false;
|
|
190
190
|
let hasCsvCollection = false;
|
|
191
|
-
const
|
|
191
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
192
|
+
for (const clientOp of clientOperations) {
|
|
193
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
194
|
+
route.parameters.parameters.forEach((parameter) => {
|
|
195
|
+
const serializeInfo = getSpecialSerializeInfo(
|
|
196
|
+
parameter.type,
|
|
197
|
+
(parameter as any).format
|
|
198
|
+
);
|
|
199
|
+
hasMultiCollection = hasMultiCollection
|
|
200
|
+
? hasMultiCollection
|
|
201
|
+
: serializeInfo.hasMultiCollection;
|
|
202
|
+
hasPipeCollection = hasPipeCollection
|
|
203
|
+
? hasPipeCollection
|
|
204
|
+
: serializeInfo.hasPipeCollection;
|
|
205
|
+
hasTsvCollection = hasTsvCollection
|
|
206
|
+
? hasTsvCollection
|
|
207
|
+
: serializeInfo.hasTsvCollection;
|
|
208
|
+
hasSsvCollection = hasSsvCollection
|
|
209
|
+
? hasSsvCollection
|
|
210
|
+
: serializeInfo.hasSsvCollection;
|
|
211
|
+
hasCsvCollection = hasCsvCollection
|
|
212
|
+
? hasCsvCollection
|
|
213
|
+
: serializeInfo.hasCsvCollection;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
192
217
|
for (const operationGroup of operationGroups) {
|
|
193
218
|
const operations = listOperationsInOperationGroup(
|
|
194
219
|
dpgContext,
|
|
@@ -219,31 +244,6 @@ function extractSpecialSerializeInfo(
|
|
|
219
244
|
});
|
|
220
245
|
}
|
|
221
246
|
}
|
|
222
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
223
|
-
for (const clientOp of clientOperations) {
|
|
224
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
225
|
-
route.parameters.parameters.forEach((parameter) => {
|
|
226
|
-
const serializeInfo = getSpecialSerializeInfo(
|
|
227
|
-
parameter.type,
|
|
228
|
-
(parameter as any).format
|
|
229
|
-
);
|
|
230
|
-
hasMultiCollection = hasMultiCollection
|
|
231
|
-
? hasMultiCollection
|
|
232
|
-
: serializeInfo.hasMultiCollection;
|
|
233
|
-
hasPipeCollection = hasPipeCollection
|
|
234
|
-
? hasPipeCollection
|
|
235
|
-
: serializeInfo.hasPipeCollection;
|
|
236
|
-
hasTsvCollection = hasTsvCollection
|
|
237
|
-
? hasTsvCollection
|
|
238
|
-
: serializeInfo.hasTsvCollection;
|
|
239
|
-
hasSsvCollection = hasSsvCollection
|
|
240
|
-
? hasSsvCollection
|
|
241
|
-
: serializeInfo.hasSsvCollection;
|
|
242
|
-
hasCsvCollection = hasCsvCollection
|
|
243
|
-
? hasCsvCollection
|
|
244
|
-
: serializeInfo.hasCsvCollection;
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
247
|
return {
|
|
248
248
|
hasMultiCollection,
|
|
249
249
|
hasPipeCollection,
|
|
@@ -48,9 +48,18 @@ export function transformToParameterTypes(
|
|
|
48
48
|
dpgContext: SdkContext
|
|
49
49
|
): OperationParameter[] {
|
|
50
50
|
const program = dpgContext.program;
|
|
51
|
-
const operationGroups = listOperationGroups(dpgContext, client);
|
|
52
51
|
const rlcParameters: OperationParameter[] = [];
|
|
53
52
|
const outputImportedSet = new Set<string>();
|
|
53
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
54
|
+
for (const clientOp of clientOperations) {
|
|
55
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
56
|
+
// ignore overload base operation
|
|
57
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
transformToParameterTypesForRoute(program, route);
|
|
61
|
+
}
|
|
62
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
54
63
|
for (const operationGroup of operationGroups) {
|
|
55
64
|
const operations = listOperationsInOperationGroup(
|
|
56
65
|
dpgContext,
|
|
@@ -65,15 +74,7 @@ export function transformToParameterTypes(
|
|
|
65
74
|
transformToParameterTypesForRoute(program, route);
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
|
-
|
|
69
|
-
for (const clientOp of clientOperations) {
|
|
70
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
71
|
-
// ignore overload base operation
|
|
72
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
transformToParameterTypesForRoute(program, route);
|
|
76
|
-
}
|
|
77
|
+
|
|
77
78
|
if (outputImportedSet.size > 0) {
|
|
78
79
|
importDetails.parameter.importsSet = outputImportedSet;
|
|
79
80
|
}
|
|
@@ -38,8 +38,17 @@ export function transformPaths(
|
|
|
38
38
|
client: SdkClient,
|
|
39
39
|
dpgContext: SdkContext
|
|
40
40
|
): Paths {
|
|
41
|
-
const operationGroups = listOperationGroups(dpgContext, client);
|
|
42
41
|
const paths: Paths = {};
|
|
42
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
43
|
+
for (const clientOp of clientOperations) {
|
|
44
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
45
|
+
// ignore overload base operation
|
|
46
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
transformOperation(dpgContext, route, paths);
|
|
50
|
+
}
|
|
51
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
43
52
|
for (const operationGroup of operationGroups) {
|
|
44
53
|
const operations = listOperationsInOperationGroup(
|
|
45
54
|
dpgContext,
|
|
@@ -54,15 +63,7 @@ export function transformPaths(
|
|
|
54
63
|
transformOperation(dpgContext, route, paths);
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
|
-
|
|
58
|
-
for (const clientOp of clientOperations) {
|
|
59
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
60
|
-
// ignore overload base operation
|
|
61
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
transformOperation(dpgContext, route, paths);
|
|
65
|
-
}
|
|
66
|
+
|
|
66
67
|
return paths;
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -43,9 +43,18 @@ export function transformToResponseTypes(
|
|
|
43
43
|
dpgContext: SdkContext
|
|
44
44
|
): OperationResponse[] {
|
|
45
45
|
const program = dpgContext.program;
|
|
46
|
-
const operationGroups = listOperationGroups(dpgContext, client);
|
|
47
46
|
const rlcResponses: OperationResponse[] = [];
|
|
48
47
|
const inputImportedSet = new Set<string>();
|
|
48
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
49
|
+
for (const clientOp of clientOperations) {
|
|
50
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
51
|
+
// ignore overload base operation
|
|
52
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
transformToResponseTypesForRoute(route);
|
|
56
|
+
}
|
|
57
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
49
58
|
for (const operationGroup of operationGroups) {
|
|
50
59
|
const operations = listOperationsInOperationGroup(
|
|
51
60
|
dpgContext,
|
|
@@ -60,15 +69,6 @@ export function transformToResponseTypes(
|
|
|
60
69
|
transformToResponseTypesForRoute(route);
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
64
|
-
for (const clientOp of clientOperations) {
|
|
65
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
66
|
-
// ignore overload base operation
|
|
67
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
transformToResponseTypesForRoute(route);
|
|
71
|
-
}
|
|
72
72
|
if (inputImportedSet.size > 0) {
|
|
73
73
|
importDetails.response.importsSet = inputImportedSet;
|
|
74
74
|
}
|
|
@@ -28,8 +28,17 @@ export function transformSchemas(
|
|
|
28
28
|
SchemaContext[]
|
|
29
29
|
>();
|
|
30
30
|
const schemaMap: Map<any, any> = new Map<any, any>();
|
|
31
|
-
const operationGroups = listOperationGroups(dpgContext, client);
|
|
32
31
|
const modelKey = Symbol("typescript-models-" + client.name);
|
|
32
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
33
|
+
for (const clientOp of clientOperations) {
|
|
34
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
35
|
+
// ignore overload base operation
|
|
36
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
transformSchemaForRoute(route);
|
|
40
|
+
}
|
|
41
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
33
42
|
for (const operationGroup of operationGroups) {
|
|
34
43
|
const operations = listOperationsInOperationGroup(
|
|
35
44
|
dpgContext,
|
|
@@ -44,15 +53,6 @@ export function transformSchemas(
|
|
|
44
53
|
transformSchemaForRoute(route);
|
|
45
54
|
}
|
|
46
55
|
}
|
|
47
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
48
|
-
for (const clientOp of clientOperations) {
|
|
49
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
50
|
-
// ignore overload base operation
|
|
51
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
transformSchemaForRoute(route);
|
|
55
|
-
}
|
|
56
56
|
function transformSchemaForRoute(route: HttpOperation) {
|
|
57
57
|
if (route.parameters) {
|
|
58
58
|
for (const param of route.parameters.parameters) {
|
|
@@ -30,7 +30,16 @@ function getCustomRequestHeaderNameForClient(
|
|
|
30
30
|
client: SdkClient
|
|
31
31
|
) {
|
|
32
32
|
const program = dpgContext.program;
|
|
33
|
-
const
|
|
33
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
34
|
+
for (const clientOp of clientOperations) {
|
|
35
|
+
const headerName = getCustomRequestHeaderNameForOperation(
|
|
36
|
+
ignoreDiagnostics(getHttpOperation(program, clientOp))
|
|
37
|
+
);
|
|
38
|
+
if (headerName !== undefined) {
|
|
39
|
+
return headerName;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
34
43
|
for (const operationGroup of operationGroups) {
|
|
35
44
|
const operations = listOperationsInOperationGroup(
|
|
36
45
|
dpgContext,
|
|
@@ -45,14 +54,5 @@ function getCustomRequestHeaderNameForClient(
|
|
|
45
54
|
}
|
|
46
55
|
}
|
|
47
56
|
}
|
|
48
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
49
|
-
for (const clientOp of clientOperations) {
|
|
50
|
-
const headerName = getCustomRequestHeaderNameForOperation(
|
|
51
|
-
ignoreDiagnostics(getHttpOperation(program, clientOp))
|
|
52
|
-
);
|
|
53
|
-
if (headerName !== undefined) {
|
|
54
|
-
return headerName;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
57
|
return undefined;
|
|
58
58
|
}
|
|
@@ -180,7 +180,17 @@ function detectIfNameConflicts(dpgContext: SdkContext) {
|
|
|
180
180
|
for (const client of clients) {
|
|
181
181
|
// only consider it's conflict when there are conflicts in the same client
|
|
182
182
|
const nameSet = new Set<string>();
|
|
183
|
-
const
|
|
183
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
184
|
+
for (const clientOp of clientOperations) {
|
|
185
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
186
|
+
const name = getOperationName(program, route.operation);
|
|
187
|
+
if (nameSet.has(name)) {
|
|
188
|
+
return true;
|
|
189
|
+
} else {
|
|
190
|
+
nameSet.add(name);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
184
194
|
for (const operationGroup of operationGroups) {
|
|
185
195
|
const operations = listOperationsInOperationGroup(
|
|
186
196
|
dpgContext,
|
|
@@ -196,16 +206,6 @@ function detectIfNameConflicts(dpgContext: SdkContext) {
|
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
208
|
}
|
|
199
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
200
|
-
for (const clientOp of clientOperations) {
|
|
201
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
202
|
-
const name = getOperationName(program, route.operation);
|
|
203
|
-
if (nameSet.has(name)) {
|
|
204
|
-
return true;
|
|
205
|
-
} else {
|
|
206
|
-
nameSet.add(name);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
// No conflicts if we didn't detect any
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isService,
|
|
6
6
|
Operation
|
|
7
7
|
} from "@typespec/compiler";
|
|
8
|
-
import { SdkContext } from "
|
|
8
|
+
import { SdkContext } from "./interfaces.js";
|
|
9
9
|
|
|
10
10
|
export function getModelNamespaceName(
|
|
11
11
|
dpgContext: SdkContext,
|
|
@@ -40,7 +40,11 @@ export function getOperationNamespaceInterfaceName(
|
|
|
40
40
|
result.push(operation.interface.name);
|
|
41
41
|
return result;
|
|
42
42
|
}
|
|
43
|
-
if (
|
|
43
|
+
if (
|
|
44
|
+
operation.interface.namespace &&
|
|
45
|
+
!isGlobalNamespace(dpgContext.program, operation.interface.namespace) &&
|
|
46
|
+
!isService(dpgContext.program, operation.interface.namespace)
|
|
47
|
+
) {
|
|
44
48
|
result.push(
|
|
45
49
|
...getModelNamespaceName(dpgContext, operation.interface.namespace)
|
|
46
50
|
);
|
|
@@ -292,8 +292,8 @@ export function extractOperationLroDetail(
|
|
|
292
292
|
const metadata = getLroMetadata(program, operation.operation);
|
|
293
293
|
precedence =
|
|
294
294
|
metadata?.finalStep &&
|
|
295
|
-
metadata?.finalStep.target &&
|
|
296
295
|
metadata.finalStep.kind === "pollingSuccessProperty" &&
|
|
296
|
+
metadata?.finalStep.target &&
|
|
297
297
|
metadata?.finalStep?.target?.name === "result"
|
|
298
298
|
? OPERATION_LRO_HIGH_PRIORITY
|
|
299
299
|
: OPERATION_LRO_LOW_PRIORITY;
|
|
@@ -312,7 +312,18 @@ export function hasPollingOperations(
|
|
|
312
312
|
client: SdkClient,
|
|
313
313
|
dpgContext: SdkContext
|
|
314
314
|
) {
|
|
315
|
-
const
|
|
315
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
316
|
+
for (const clientOp of clientOperations) {
|
|
317
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
318
|
+
// ignore overload base operation
|
|
319
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
if (isLongRunningOperation(program, route)) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
316
327
|
for (const operationGroup of operationGroups) {
|
|
317
328
|
const operations = listOperationsInOperationGroup(
|
|
318
329
|
dpgContext,
|
|
@@ -329,18 +340,6 @@ export function hasPollingOperations(
|
|
|
329
340
|
}
|
|
330
341
|
}
|
|
331
342
|
}
|
|
332
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
333
|
-
for (const clientOp of clientOperations) {
|
|
334
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
335
|
-
// ignore overload base operation
|
|
336
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
if (isLongRunningOperation(program, route)) {
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
343
|
return false;
|
|
345
344
|
}
|
|
346
345
|
|
|
@@ -359,7 +358,18 @@ export function hasPagingOperations(
|
|
|
359
358
|
client: SdkClient,
|
|
360
359
|
dpgContext: SdkContext
|
|
361
360
|
) {
|
|
362
|
-
const
|
|
361
|
+
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
362
|
+
for (const clientOp of clientOperations) {
|
|
363
|
+
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
364
|
+
// ignore overload base operation
|
|
365
|
+
if (route.overloads && route.overloads?.length > 0) {
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (isPagingOperation(program, route)) {
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const operationGroups = listOperationGroups(dpgContext, client, true);
|
|
363
373
|
for (const operationGroup of operationGroups) {
|
|
364
374
|
const operations = listOperationsInOperationGroup(
|
|
365
375
|
dpgContext,
|
|
@@ -376,17 +386,6 @@ export function hasPagingOperations(
|
|
|
376
386
|
}
|
|
377
387
|
}
|
|
378
388
|
}
|
|
379
|
-
const clientOperations = listOperationsInOperationGroup(dpgContext, client);
|
|
380
|
-
for (const clientOp of clientOperations) {
|
|
381
|
-
const route = ignoreDiagnostics(getHttpOperation(program, clientOp));
|
|
382
|
-
// ignore overload base operation
|
|
383
|
-
if (route.overloads && route.overloads?.length > 0) {
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
if (isPagingOperation(program, route)) {
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
389
|
return false;
|
|
391
390
|
}
|
|
392
391
|
|