@azure-tools/typespec-rust 0.24.1 → 0.26.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/dist/src/codegen/clients.d.ts.map +1 -1
- package/dist/src/codegen/clients.js +185 -119
- package/dist/src/codegen/clients.js.map +1 -1
- package/dist/src/codegen/context.d.ts.map +1 -1
- package/dist/src/codegen/context.js +3 -1
- package/dist/src/codegen/context.js.map +1 -1
- package/dist/src/codegen/enums.d.ts +2 -2
- package/dist/src/codegen/enums.js +173 -26
- package/dist/src/codegen/enums.js.map +1 -1
- package/dist/src/codegen/helpers.d.ts +10 -0
- package/dist/src/codegen/helpers.d.ts.map +1 -1
- package/dist/src/codegen/helpers.js +30 -4
- package/dist/src/codegen/helpers.js.map +1 -1
- package/dist/src/codegen/models.js +28 -23
- package/dist/src/codegen/models.js.map +1 -1
- package/dist/src/codemodel/client.d.ts +10 -8
- package/dist/src/codemodel/client.d.ts.map +1 -1
- package/dist/src/codemodel/client.js +1 -0
- package/dist/src/codemodel/client.js.map +1 -1
- package/dist/src/codemodel/crate.d.ts.map +1 -1
- package/dist/src/codemodel/crate.js +5 -2
- package/dist/src/codemodel/crate.js.map +1 -1
- package/dist/src/codemodel/types.d.ts +10 -13
- package/dist/src/codemodel/types.d.ts.map +1 -1
- package/dist/src/codemodel/types.js +4 -8
- package/dist/src/codemodel/types.js.map +1 -1
- package/dist/src/shared/shared.d.ts.map +1 -1
- package/dist/src/shared/shared.js +4 -1
- package/dist/src/shared/shared.js.map +1 -1
- package/dist/src/tcgcadapter/adapter.d.ts +9 -1
- package/dist/src/tcgcadapter/adapter.d.ts.map +1 -1
- package/dist/src/tcgcadapter/adapter.js +147 -79
- package/dist/src/tcgcadapter/adapter.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/codemodel/types.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;A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AI,CAAC,GAAG,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/shared/shared.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAKvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAqBnI;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,iBAAiB,CASvF"}
|
|
@@ -38,6 +38,10 @@ export function asTypeOf(type, targetKind, ...wrappedIn) {
|
|
|
38
38
|
else if (current.kind === wrapper) {
|
|
39
39
|
current = unwrap(current);
|
|
40
40
|
}
|
|
41
|
+
else {
|
|
42
|
+
// sequence of types don't match so we're done
|
|
43
|
+
current = undefined;
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
if ((current === null || current === void 0 ? void 0 : current.kind) === targetKind) {
|
|
43
47
|
return current;
|
|
@@ -78,7 +82,6 @@ function unwrap(type) {
|
|
|
78
82
|
case 'literal':
|
|
79
83
|
return type.valueKind;
|
|
80
84
|
case 'option':
|
|
81
|
-
case 'pageIterator':
|
|
82
85
|
case 'pager':
|
|
83
86
|
case 'ref':
|
|
84
87
|
return type.type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/shared/shared.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAI/F;;;;;GAKG;AACH,M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B,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,SAAS,CAAC;QACf,KAAK,WAAW;YACd,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,KAAK;YACR,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,gBAAgB;YACnB,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBAC1B,KAAK,OAAO;oBACV,OAAO,IAAI,CAAC,OAAO,CAAC;gBACtB,KAAK,SAAS;oBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC3B;oBACE,OAAO,IAAI,CAAC,OAAO,CAAC;YACxB,CAAC;QACH,KAAK,UAAU;YACb,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -44,7 +44,6 @@ export declare class Adapter {
|
|
|
44
44
|
private readonly options;
|
|
45
45
|
private readonly types;
|
|
46
46
|
private readonly clientMethodParams;
|
|
47
|
-
private readonly renamedMethods;
|
|
48
47
|
private readonly fieldsMap;
|
|
49
48
|
private constructor();
|
|
50
49
|
/** performs all the steps to convert tcgc to a crate */
|
|
@@ -219,6 +218,15 @@ export declare class Adapter {
|
|
|
219
218
|
* @returns the pageable strategy
|
|
220
219
|
*/
|
|
221
220
|
private adaptPageableMethodStrategy;
|
|
221
|
+
/**
|
|
222
|
+
* returns the array of pageable method parameters for reinjection.
|
|
223
|
+
* if no parameters require reinjection, the array is empty.
|
|
224
|
+
*
|
|
225
|
+
* @param method the pageable method
|
|
226
|
+
* @param paramsMap maps tcgc method params to Rust params
|
|
227
|
+
* @returns an array containing the method parameters for reinjection
|
|
228
|
+
*/
|
|
229
|
+
private adaptPageableMethodReinjectionParams;
|
|
222
230
|
/**
|
|
223
231
|
* converts a tcgc operation parameter into a Rust method parameter
|
|
224
232
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/tcgcadapter/adapter.ts"],"names":[],"mappings":"AASA,OAAO,EAAyB,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAIpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAE9C,oDAAoD;AACpD,MAAM,MAAM,SAAS;AACnB,qFAAqF;AACrF,eAAe;AAEf,mDAAmD;AACnD,iBAAiB;AAEjB;;;GAGG;AACH,eAAe;AAEf,sEAAsE;AACtE,gBAAgB,CAAC;AAEnB;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,QAAQ,CAAC;gBAExC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB;CAKxE;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;CAAI;AAE5C,2DAA2D;AAC3D,qBAAa,OAAO;IAClB;;;;;OAKG;WACU,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAuB/E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;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AO,CAAC,oBAAoB;IA4C5B;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAoXnB;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAoB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAqEjC;;;;;;;OAOG;IACH,OAAO,CAAC,2BAA2B;IAyEnC;;;;;;;OAOG;IACH,OAAO,CAAC,oCAAoC;IA0B5C;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAoK5B;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAsD5B;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IA6BtB;;;;;;;OAOG;IACH,OAAO,CAAC,0BAA0B;IA2BlC;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;CAa/B"}
|
|
@@ -42,7 +42,7 @@ export class Adapter {
|
|
|
42
42
|
// same as TypeSpec.Xml.@name. however, it's filtered out by default
|
|
43
43
|
// so we need to add it to the allow list of decorators
|
|
44
44
|
const ctx = await tcgc.createSdkContext(context, '@azure-tools/typespec-rust', {
|
|
45
|
-
additionalDecorators: ['TypeSpec\\.@encodedName', '@clientName'],
|
|
45
|
+
additionalDecorators: ['TypeSpec\\.@encodedName', '@clientName', 'Azure.ClientGenerator.Core.@deserializeEmptyStringAsNull'],
|
|
46
46
|
disableUsageAccessPropagationToBase: true,
|
|
47
47
|
});
|
|
48
48
|
context.program.reportDiagnostics(ctx.diagnostics);
|
|
@@ -60,7 +60,6 @@ export class Adapter {
|
|
|
60
60
|
constructor(ctx, options) {
|
|
61
61
|
this.types = new Map();
|
|
62
62
|
this.clientMethodParams = new Map();
|
|
63
|
-
this.renamedMethods = new Set();
|
|
64
63
|
this.fieldsMap = new Map();
|
|
65
64
|
this.ctx = ctx;
|
|
66
65
|
this.options = options;
|
|
@@ -79,7 +78,7 @@ export class Adapter {
|
|
|
79
78
|
this.crate.addDependency(new rust.CrateDependency('serde'));
|
|
80
79
|
}
|
|
81
80
|
if (this.crate.clients.length > 0 || this.crate.enums.length > 0 || this.crate.models.length > 0 || this.crate.unions.length > 0) {
|
|
82
|
-
this.crate.addDependency(new rust.CrateDependency('
|
|
81
|
+
this.crate.addDependency(new rust.CrateDependency('azure_core'));
|
|
83
82
|
}
|
|
84
83
|
this.crate.sortContent();
|
|
85
84
|
return this.crate;
|
|
@@ -121,8 +120,6 @@ export class Adapter {
|
|
|
121
120
|
}
|
|
122
121
|
const rustModel = this.getModel(model);
|
|
123
122
|
this.crate.models.push(rustModel);
|
|
124
|
-
// presence of models requires the derive feature
|
|
125
|
-
this.crate.addDependency(new rust.CrateDependency('typespec_client_core', ['derive']));
|
|
126
123
|
}
|
|
127
124
|
}
|
|
128
125
|
/**
|
|
@@ -132,13 +129,36 @@ export class Adapter {
|
|
|
132
129
|
* @returns a Rust enum
|
|
133
130
|
*/
|
|
134
131
|
getEnum(sdkEnum) {
|
|
135
|
-
var _a;
|
|
136
|
-
const enumName = codegen.
|
|
132
|
+
var _a, _b;
|
|
133
|
+
const enumName = codegen.deconstruct(sdkEnum.name).map((each) => codegen.capitalize(each)).join('');
|
|
137
134
|
let rustEnum = this.types.get(enumName);
|
|
138
135
|
if (rustEnum) {
|
|
139
136
|
return rustEnum;
|
|
140
137
|
}
|
|
141
|
-
|
|
138
|
+
let enumType;
|
|
139
|
+
switch (sdkEnum.valueType.kind) {
|
|
140
|
+
case 'float':
|
|
141
|
+
case 'float32':
|
|
142
|
+
enumType = 'f32';
|
|
143
|
+
break;
|
|
144
|
+
case 'float64':
|
|
145
|
+
enumType = 'f64';
|
|
146
|
+
break;
|
|
147
|
+
case 'int8':
|
|
148
|
+
case 'int16':
|
|
149
|
+
case 'int32':
|
|
150
|
+
enumType = 'i32';
|
|
151
|
+
break;
|
|
152
|
+
case 'int64':
|
|
153
|
+
enumType = 'i64';
|
|
154
|
+
break;
|
|
155
|
+
case 'string':
|
|
156
|
+
enumType = 'String';
|
|
157
|
+
break;
|
|
158
|
+
default:
|
|
159
|
+
throw new AdapterError('UnsupportedTsp', `unsupported enum underlying type ${sdkEnum.valueType.kind}`, (_a = sdkEnum.__raw) === null || _a === void 0 ? void 0 : _a.node);
|
|
160
|
+
}
|
|
161
|
+
rustEnum = new rust.Enum(enumName, sdkEnum.access === 'public', !sdkEnum.isFixed, enumType);
|
|
142
162
|
rustEnum.docs = this.adaptDocs(sdkEnum.summary, sdkEnum.doc);
|
|
143
163
|
this.types.set(enumName, rustEnum);
|
|
144
164
|
const rustEnumNameToSdkEnumName = new Map();
|
|
@@ -146,7 +166,7 @@ export class Adapter {
|
|
|
146
166
|
const enumValueName = naming.fixUpEnumValueName(value);
|
|
147
167
|
const existingMapping = rustEnumNameToSdkEnumName.get(enumValueName);
|
|
148
168
|
if (existingMapping) {
|
|
149
|
-
throw new AdapterError('NameCollision', `enum values ${value.name} and ${existingMapping} coalesce into the same name ${enumValueName}`, (
|
|
169
|
+
throw new AdapterError('NameCollision', `enum values ${value.name} and ${existingMapping} coalesce into the same name ${enumValueName}`, (_b = sdkEnum.__raw) === null || _b === void 0 ? void 0 : _b.node);
|
|
150
170
|
}
|
|
151
171
|
rustEnumNameToSdkEnumName.set(enumValueName, value.name);
|
|
152
172
|
const rustEnumValue = new rust.EnumValue(enumValueName, rustEnum, value.value);
|
|
@@ -410,6 +430,9 @@ export class Adapter {
|
|
|
410
430
|
if (!this.fieldsMap.get(property)) {
|
|
411
431
|
this.fieldsMap.set(property, modelField);
|
|
412
432
|
}
|
|
433
|
+
if (property.decorators.find((decorator) => decorator.name === 'Azure.ClientGenerator.Core.@deserializeEmptyStringAsNull') !== undefined) {
|
|
434
|
+
modelField.flags |= rust.ModelFieldFlags.DeserializeEmptyStringAsNone;
|
|
435
|
+
}
|
|
413
436
|
return modelField;
|
|
414
437
|
}
|
|
415
438
|
/**
|
|
@@ -503,6 +526,11 @@ export class Adapter {
|
|
|
503
526
|
return this.getStringType();
|
|
504
527
|
}
|
|
505
528
|
case 'nullable':
|
|
529
|
+
if (type.type.kind === 'model' && type.type.isGeneratedName) {
|
|
530
|
+
// if the nullable type's target type is a synthesized
|
|
531
|
+
// type, we need to propagate the docs to it
|
|
532
|
+
type.type.doc = type.doc;
|
|
533
|
+
}
|
|
506
534
|
// TODO: workaround until https://github.com/Azure/typespec-rust/issues/42 is fixed
|
|
507
535
|
return this.getType(type.type, stack);
|
|
508
536
|
case 'offsetDateTime': {
|
|
@@ -780,7 +808,7 @@ export class Adapter {
|
|
|
780
808
|
* @returns a Rust client
|
|
781
809
|
*/
|
|
782
810
|
recursiveAdaptClient(client, parent) {
|
|
783
|
-
var _a, _b, _c, _d
|
|
811
|
+
var _a, _b, _c, _d;
|
|
784
812
|
let clientName = client.name;
|
|
785
813
|
// NOTE: if the client has the @clientName decorator applied then use that verbatim
|
|
786
814
|
if (parent && !hasClientNameDecorator(client.decorators)) {
|
|
@@ -826,30 +854,35 @@ export class Adapter {
|
|
|
826
854
|
(function (AuthTypes) {
|
|
827
855
|
AuthTypes[AuthTypes["Default"] = 0] = "Default";
|
|
828
856
|
AuthTypes[AuthTypes["NoAuth"] = 1] = "NoAuth";
|
|
829
|
-
AuthTypes[AuthTypes["
|
|
857
|
+
AuthTypes[AuthTypes["WithAuth"] = 2] = "WithAuth";
|
|
830
858
|
})(AuthTypes || (AuthTypes = {}));
|
|
831
859
|
let authType = AuthTypes.Default;
|
|
832
860
|
/**
|
|
833
861
|
* processes a credential, potentially adding its supporting client constructor
|
|
834
862
|
*
|
|
863
|
+
* @param rustClient the client for which the constructor will be added
|
|
864
|
+
* @param param the tsp parameter that contains cred
|
|
835
865
|
* @param cred the credential type to process
|
|
836
866
|
* @param constructable the constructable for the current Rust client
|
|
837
|
-
* @param throwOnDefault when true, throws an error on unsupported credential types
|
|
838
867
|
* @returns the AuthTypes enum for the credential that was handled, or AuthTypes.Default if none were
|
|
839
868
|
*/
|
|
840
|
-
const processCredential = (rustClient, cred, constructable
|
|
869
|
+
const processCredential = (rustClient, param, cred, constructable) => {
|
|
870
|
+
var _a, _b;
|
|
841
871
|
switch (cred.type) {
|
|
842
872
|
case 'noAuth':
|
|
843
873
|
return AuthTypes.NoAuth;
|
|
844
874
|
case 'oauth2': {
|
|
845
875
|
constructable.constructors.push(this.createTokenCredentialCtor(rustClient, cred));
|
|
846
|
-
return AuthTypes.
|
|
876
|
+
return AuthTypes.WithAuth;
|
|
847
877
|
}
|
|
848
878
|
default:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
879
|
+
this.ctx.program.reportDiagnostic({
|
|
880
|
+
code: 'UnsupportedAuthenticationScheme',
|
|
881
|
+
severity: 'warning',
|
|
882
|
+
message: `authentication scheme ${cred.type} is not supported`,
|
|
883
|
+
target: (_b = (_a = param.__raw) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : NoTarget,
|
|
884
|
+
});
|
|
885
|
+
return AuthTypes.WithAuth;
|
|
853
886
|
}
|
|
854
887
|
};
|
|
855
888
|
const ctorParams = new Array();
|
|
@@ -858,7 +891,7 @@ export class Adapter {
|
|
|
858
891
|
case 'credential':
|
|
859
892
|
switch (param.type.kind) {
|
|
860
893
|
case 'credential':
|
|
861
|
-
authType |= processCredential(rustClient, param.type.scheme, rustClient.constructable
|
|
894
|
+
authType |= processCredential(rustClient, param, param.type.scheme, rustClient.constructable);
|
|
862
895
|
break;
|
|
863
896
|
case 'union': {
|
|
864
897
|
const variantKinds = new Array();
|
|
@@ -867,13 +900,8 @@ export class Adapter {
|
|
|
867
900
|
// if OAuth2 is specified then emit that and skip any unsupported ones.
|
|
868
901
|
// this prevents emitting the with_no_credential constructor in cases
|
|
869
902
|
// where it might not actually be supported.
|
|
870
|
-
authType |= processCredential(rustClient, variantType.scheme, rustClient.constructable
|
|
903
|
+
authType |= processCredential(rustClient, param, variantType.scheme, rustClient.constructable);
|
|
871
904
|
}
|
|
872
|
-
// no supported credential types were specified
|
|
873
|
-
if (authType === AuthTypes.Default) {
|
|
874
|
-
throw new AdapterError('UnsupportedTsp', `credential scheme types ${variantKinds.join()} NYI`, (_a = param.__raw) === null || _a === void 0 ? void 0 : _a.node);
|
|
875
|
-
}
|
|
876
|
-
continue;
|
|
877
905
|
}
|
|
878
906
|
}
|
|
879
907
|
break;
|
|
@@ -912,26 +940,16 @@ export class Adapter {
|
|
|
912
940
|
// there's either a suffix on the endpoint param, more template arguments, or both.
|
|
913
941
|
// either way we need to create supplemental info on the constructable.
|
|
914
942
|
// NOTE: we remove the {endpoint} segment and trailing forward slash as we use
|
|
915
|
-
//
|
|
916
|
-
|
|
917
|
-
// NOTE: the behavior of Url::join requires that the path ends with a forward slash.
|
|
918
|
-
// if there are any query params, splice it in as required else just append it.
|
|
919
|
-
if (serverUrl.includes('?')) {
|
|
920
|
-
if (serverUrl[serverUrl.indexOf('?') - 1] !== '/') {
|
|
921
|
-
serverUrl = serverUrl.replace('?', '/?');
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
else if (serverUrl[serverUrl.length - 1] !== '/') {
|
|
925
|
-
serverUrl += '/';
|
|
926
|
-
}
|
|
943
|
+
// UrlExt::append_path() to concatenate the two and not string replacement.
|
|
944
|
+
const serverUrl = endpointType.serverUrl.replace(`{${templateArg.serializedName}}/`, '');
|
|
927
945
|
rustClient.constructable.endpoint = new rust.SupplementalEndpoint(serverUrl);
|
|
928
946
|
continue;
|
|
929
947
|
}
|
|
930
948
|
const clientParam = this.adaptClientParameter(templateArg, rustClient.constructable);
|
|
931
949
|
if (clientParam.kind !== 'clientSupplementalEndpoint') {
|
|
932
|
-
throw new AdapterError('InternalError', `unexpected client parameter kind ${clientParam.kind}`, (
|
|
950
|
+
throw new AdapterError('InternalError', `unexpected client parameter kind ${clientParam.kind}`, (_a = templateArg.__raw) === null || _a === void 0 ? void 0 : _a.node);
|
|
933
951
|
}
|
|
934
|
-
(
|
|
952
|
+
(_b = rustClient.constructable.endpoint) === null || _b === void 0 ? void 0 : _b.parameters.push(clientParam);
|
|
935
953
|
ctorParams.push(clientParam);
|
|
936
954
|
}
|
|
937
955
|
break;
|
|
@@ -991,7 +1009,7 @@ export class Adapter {
|
|
|
991
1009
|
code: 'LroPagingNotSupported',
|
|
992
1010
|
severity: 'warning',
|
|
993
1011
|
message: `skip emitting Paging LRO ${method.name}`,
|
|
994
|
-
target: (
|
|
1012
|
+
target: (_d = (_c = method.__raw) === null || _c === void 0 ? void 0 : _c.node) !== null && _d !== void 0 ? _d : NoTarget,
|
|
995
1013
|
});
|
|
996
1014
|
continue;
|
|
997
1015
|
}
|
|
@@ -1112,13 +1130,17 @@ export class Adapter {
|
|
|
1112
1130
|
* @param rustClient the client to which the method belongs
|
|
1113
1131
|
*/
|
|
1114
1132
|
adaptMethod(method, rustClient) {
|
|
1115
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1133
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1116
1134
|
let srcMethodName = method.name;
|
|
1117
1135
|
if (method.kind === 'paging' && !srcMethodName.match(/^list/i)) {
|
|
1118
1136
|
const chunks = codegen.deconstruct(srcMethodName);
|
|
1119
|
-
chunks[0]
|
|
1137
|
+
if (chunks[0] === 'get') {
|
|
1138
|
+
chunks[0] = 'list';
|
|
1139
|
+
}
|
|
1140
|
+
else {
|
|
1141
|
+
chunks.unshift('list');
|
|
1142
|
+
}
|
|
1120
1143
|
srcMethodName = codegen.camelCase(chunks);
|
|
1121
|
-
this.renamedMethods.add(srcMethodName);
|
|
1122
1144
|
this.ctx.program.reportDiagnostic({
|
|
1123
1145
|
code: 'PagingMethodRename',
|
|
1124
1146
|
severity: 'warning',
|
|
@@ -1126,13 +1148,18 @@ export class Adapter {
|
|
|
1126
1148
|
target: (_b = (_a = method.__raw) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : NoTarget,
|
|
1127
1149
|
});
|
|
1128
1150
|
}
|
|
1129
|
-
else if (this.renamedMethods.has(srcMethodName)) {
|
|
1130
|
-
throw new AdapterError('NameCollision', `method name ${srcMethodName} collides with a renamed method`, (_c = method.__raw) === null || _c === void 0 ? void 0 : _c.node);
|
|
1131
|
-
}
|
|
1132
1151
|
const languageIndependentName = method.crossLanguageDefinitionId;
|
|
1133
1152
|
const methodName = naming.getEscapedReservedName(snakeCaseName(srcMethodName), 'fn');
|
|
1153
|
+
if (srcMethodName !== method.name) {
|
|
1154
|
+
// if the method was renamed then ensure it doesn't collide
|
|
1155
|
+
for (const existingMethod of rustClient.methods) {
|
|
1156
|
+
if (existingMethod.name === methodName) {
|
|
1157
|
+
throw new AdapterError('NameCollision', `renamed method ${srcMethodName} collides with an existing method`, (_c = method.__raw) === null || _c === void 0 ? void 0 : _c.node);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1134
1161
|
const optionsLifetime = new rust.Lifetime('a');
|
|
1135
|
-
const methodOptionsStruct = new rust.Struct(`${rustClient.name}${codegen.pascalCase(srcMethodName)}Options`, 'pub');
|
|
1162
|
+
const methodOptionsStruct = new rust.Struct(`${rustClient.name}${codegen.pascalCase(srcMethodName, false)}Options`, 'pub');
|
|
1136
1163
|
methodOptionsStruct.lifetime = optionsLifetime;
|
|
1137
1164
|
methodOptionsStruct.docs.summary = `Options to be passed to ${this.asDocLink(`${rustClient.name}::${methodName}()`, `crate::generated::clients::${rustClient.name}::${methodName}()`)}`;
|
|
1138
1165
|
const clientMethodOptions = new rust.ExternalType(this.crate, 'ClientMethodOptions', 'azure_core::http');
|
|
@@ -1149,27 +1176,16 @@ export class Adapter {
|
|
|
1149
1176
|
const pub = method.access === 'public' ? 'pub' : 'pubCrate';
|
|
1150
1177
|
const methodOptions = new rust.MethodOptions(methodOptionsStruct);
|
|
1151
1178
|
const httpMethod = method.operation.verb;
|
|
1152
|
-
// if path is more than just "/" strip off any leading forward slash.
|
|
1153
|
-
// this is because Url::join will treat the path as absolute, overwriting
|
|
1154
|
-
// any existing path on the endpoint.
|
|
1155
|
-
// e.g. if endpoint is https://contoso.com/foo/bar and httpPath is /some/sub/path
|
|
1156
|
-
// then calling Url::join will provide result https://contoso.com/some/sub/path
|
|
1157
|
-
// which is not what we want.
|
|
1158
|
-
// the only exception is if this is the root before the query string
|
|
1159
|
-
let httpPath = method.operation.path;
|
|
1160
|
-
if (httpPath.length > 1 && httpPath[0] === '/' && !httpPath.startsWith('/?')) {
|
|
1161
|
-
httpPath = httpPath.slice(1);
|
|
1162
|
-
}
|
|
1163
1179
|
let rustMethod;
|
|
1164
1180
|
switch (method.kind) {
|
|
1165
1181
|
case 'basic':
|
|
1166
|
-
rustMethod = new rust.AsyncMethod(methodName, languageIndependentName, rustClient, pub, methodOptions, httpMethod,
|
|
1182
|
+
rustMethod = new rust.AsyncMethod(methodName, languageIndependentName, rustClient, pub, methodOptions, httpMethod, method.operation.path);
|
|
1167
1183
|
break;
|
|
1168
1184
|
case 'paging':
|
|
1169
|
-
rustMethod = new rust.PageableMethod(methodName, languageIndependentName, rustClient, pub, methodOptions, httpMethod,
|
|
1185
|
+
rustMethod = new rust.PageableMethod(methodName, languageIndependentName, rustClient, pub, methodOptions, httpMethod, method.operation.path);
|
|
1170
1186
|
break;
|
|
1171
1187
|
case 'lro':
|
|
1172
|
-
rustMethod = new rust.LroMethod(methodName, languageIndependentName, rustClient, pub, methodOptions, httpMethod,
|
|
1188
|
+
rustMethod = new rust.LroMethod(methodName, languageIndependentName, rustClient, pub, methodOptions, httpMethod, method.operation.path);
|
|
1173
1189
|
break;
|
|
1174
1190
|
default:
|
|
1175
1191
|
throw new AdapterError('UnsupportedTsp', `method kind ${method.kind} NYI`, (_d = method.__raw) === null || _d === void 0 ? void 0 : _d.node);
|
|
@@ -1197,6 +1213,11 @@ export class Adapter {
|
|
|
1197
1213
|
if (!opParam) {
|
|
1198
1214
|
throw new AdapterError('InternalError', `didn't find operation parameter for method ${method.name} parameter ${param.name}`, (_e = param.__raw) === null || _e === void 0 ? void 0 : _e.node);
|
|
1199
1215
|
}
|
|
1216
|
+
if (opParam.kind === 'header' && opParam.serializedName.toLowerCase() === 'x-ms-client-request-id') {
|
|
1217
|
+
// x-ms-client-request-id is automatically inserted into requests via
|
|
1218
|
+
// a pipeline policy. so we don't want to expose this as an actual param.
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1200
1221
|
let adaptedParam;
|
|
1201
1222
|
// for spread params there are two cases we need to consider.
|
|
1202
1223
|
// if the method param's type doesn't match the op param's type then it's a spread param
|
|
@@ -1381,14 +1402,8 @@ export class Adapter {
|
|
|
1381
1402
|
if (unwrappedCount !== method.pagingMetadata.pageItemsSegments.length) {
|
|
1382
1403
|
throw new AdapterError('InternalError', `failed to unwrap paged items for method ${method.name}`, (_m = method.__raw) === null || _m === void 0 ? void 0 : _m.node);
|
|
1383
1404
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
rustMethod.returns = new rust.Result(this.crate, new rust.PageIterator(this.crate, new rust.Response(this.crate, synthesizedModel, responseFormat)));
|
|
1387
|
-
}
|
|
1388
|
-
else {
|
|
1389
|
-
this.crate.addDependency(new rust.CrateDependency('async-trait'));
|
|
1390
|
-
rustMethod.returns = new rust.Result(this.crate, new rust.Pager(this.crate, new rust.Response(this.crate, synthesizedModel, responseFormat)));
|
|
1391
|
-
}
|
|
1405
|
+
this.crate.addDependency(new rust.CrateDependency('async-trait'));
|
|
1406
|
+
rustMethod.returns = new rust.Result(this.crate, new rust.Pager(this.crate, new rust.Response(this.crate, synthesizedModel, responseFormat)));
|
|
1392
1407
|
}
|
|
1393
1408
|
else if (method.kind === 'lro') {
|
|
1394
1409
|
const format = responseFormat === 'NoFormat' ? 'JsonFormat' : responseFormat;
|
|
@@ -1420,7 +1435,7 @@ export class Adapter {
|
|
|
1420
1435
|
else if (responseHeaders.length > 0) {
|
|
1421
1436
|
// for methods that don't return a modeled type but return headers,
|
|
1422
1437
|
// we need to return a marker type
|
|
1423
|
-
const markerType = new rust.MarkerType(`${rustClient.name}${codegen.pascalCase(method.name)}Result`);
|
|
1438
|
+
const markerType = new rust.MarkerType(`${rustClient.name}${codegen.pascalCase(method.name, false)}Result`);
|
|
1424
1439
|
markerType.docs.summary = `Contains results for ${this.asDocLink(`${rustClient.name}::${methodName}()`, `crate::generated::clients::${rustClient.name}::${methodName}()`)}`;
|
|
1425
1440
|
this.crate.models.push(markerType);
|
|
1426
1441
|
let resultType;
|
|
@@ -1453,7 +1468,11 @@ export class Adapter {
|
|
|
1453
1468
|
rustMethod.responseHeaders = this.adaptResponseHeadersTrait(rustClient, rustMethod, Array.from(responseHeadersMap.values()));
|
|
1454
1469
|
if (method.kind === 'paging') {
|
|
1455
1470
|
// can't do this until the method has been completely adapted
|
|
1456
|
-
|
|
1471
|
+
const pageableMethod = rustMethod;
|
|
1472
|
+
pageableMethod.strategy = this.adaptPageableMethodStrategy(method, paramsMap, responseHeadersMap);
|
|
1473
|
+
if (((_p = pageableMethod.strategy) === null || _p === void 0 ? void 0 : _p.kind) === 'nextLink') {
|
|
1474
|
+
pageableMethod.strategy.reinjectedParams = this.adaptPageableMethodReinjectionParams(method, paramsMap);
|
|
1475
|
+
}
|
|
1457
1476
|
}
|
|
1458
1477
|
}
|
|
1459
1478
|
/**
|
|
@@ -1534,7 +1553,6 @@ export class Adapter {
|
|
|
1534
1553
|
// response header traits are only ever for marker types and payloads
|
|
1535
1554
|
let implFor;
|
|
1536
1555
|
switch (method.returns.type.kind) {
|
|
1537
|
-
case 'pageIterator':
|
|
1538
1556
|
case 'pager':
|
|
1539
1557
|
case 'poller':
|
|
1540
1558
|
implFor = method.returns.type.type;
|
|
@@ -1564,7 +1582,7 @@ export class Adapter {
|
|
|
1564
1582
|
* @returns the pageable strategy
|
|
1565
1583
|
*/
|
|
1566
1584
|
adaptPageableMethodStrategy(method, paramsMap, respHeadersMap) {
|
|
1567
|
-
var _a, _b, _c, _d, _e;
|
|
1585
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1568
1586
|
const buildNextLinkPath = (segments) => {
|
|
1569
1587
|
var _a, _b;
|
|
1570
1588
|
// build the field path for the next link segments
|
|
@@ -1600,11 +1618,14 @@ export class Adapter {
|
|
|
1600
1618
|
if (!tokenParam) {
|
|
1601
1619
|
throw new AdapterError('InternalError', `missing continuation token request parameter name ${tokenResp.name} for operation ${method.name}`, (_b = method.__raw) === null || _b === void 0 ? void 0 : _b.node);
|
|
1602
1620
|
}
|
|
1621
|
+
else if (tokenParam.kind !== 'headerScalar' && tokenParam.kind !== 'queryScalar') {
|
|
1622
|
+
throw new AdapterError('InternalError', `unexpected continuation token request parameter kind ${tokenParam.kind} for operation ${method.name}`, (_c = method.__raw) === null || _c === void 0 ? void 0 : _c.node);
|
|
1623
|
+
}
|
|
1603
1624
|
requestToken = tokenParam;
|
|
1604
1625
|
break;
|
|
1605
1626
|
}
|
|
1606
1627
|
default:
|
|
1607
|
-
throw new AdapterError('InternalError', `unhandled continuationTokenParameterSegment kind ${tokenReq.kind}`, (
|
|
1628
|
+
throw new AdapterError('InternalError', `unhandled continuationTokenParameterSegment kind ${tokenReq.kind}`, (_d = tokenReq.__raw) === null || _d === void 0 ? void 0 : _d.node);
|
|
1608
1629
|
}
|
|
1609
1630
|
// find the continuation token response
|
|
1610
1631
|
let responseToken;
|
|
@@ -1616,7 +1637,7 @@ export class Adapter {
|
|
|
1616
1637
|
case 'responseheader': {
|
|
1617
1638
|
const tokenHeader = respHeadersMap.get(tokenResp);
|
|
1618
1639
|
if (!tokenHeader) {
|
|
1619
|
-
throw new AdapterError('InternalError', `missing continuation token response header name ${tokenResp.name} for operation ${method.name}`, (
|
|
1640
|
+
throw new AdapterError('InternalError', `missing continuation token response header name ${tokenResp.name} for operation ${method.name}`, (_e = method.__raw) === null || _e === void 0 ? void 0 : _e.node);
|
|
1620
1641
|
}
|
|
1621
1642
|
if (tokenHeader.kind !== 'responseHeaderScalar') {
|
|
1622
1643
|
throw new AdapterError('InternalError', `unexpected response header kind ${tokenHeader.kind}`);
|
|
@@ -1625,7 +1646,7 @@ export class Adapter {
|
|
|
1625
1646
|
break;
|
|
1626
1647
|
}
|
|
1627
1648
|
default:
|
|
1628
|
-
throw new AdapterError('InternalError', `missing continuation token`, (
|
|
1649
|
+
throw new AdapterError('InternalError', `missing continuation token`, (_f = method.__raw) === null || _f === void 0 ? void 0 : _f.node);
|
|
1629
1650
|
}
|
|
1630
1651
|
return new rust.PageableStrategyContinuationToken(requestToken, responseToken);
|
|
1631
1652
|
}
|
|
@@ -1634,6 +1655,39 @@ export class Adapter {
|
|
|
1634
1655
|
return undefined;
|
|
1635
1656
|
}
|
|
1636
1657
|
}
|
|
1658
|
+
/**
|
|
1659
|
+
* returns the array of pageable method parameters for reinjection.
|
|
1660
|
+
* if no parameters require reinjection, the array is empty.
|
|
1661
|
+
*
|
|
1662
|
+
* @param method the pageable method
|
|
1663
|
+
* @param paramsMap maps tcgc method params to Rust params
|
|
1664
|
+
* @returns an array containing the method parameters for reinjection
|
|
1665
|
+
*/
|
|
1666
|
+
adaptPageableMethodReinjectionParams(method, paramsMap) {
|
|
1667
|
+
var _a;
|
|
1668
|
+
if (!method.pagingMetadata.nextLinkReInjectedParametersSegments) {
|
|
1669
|
+
return [];
|
|
1670
|
+
}
|
|
1671
|
+
const paramsForReinjection = new Array();
|
|
1672
|
+
for (const reinjectedParamSegment of method.pagingMetadata.nextLinkReInjectedParametersSegments) {
|
|
1673
|
+
for (const reinjectedParam of reinjectedParamSegment) {
|
|
1674
|
+
if (reinjectedParam.kind !== 'method') {
|
|
1675
|
+
throw new Error('unexpected param kind');
|
|
1676
|
+
}
|
|
1677
|
+
const rustParam = paramsMap.get(reinjectedParam);
|
|
1678
|
+
if (!rustParam) {
|
|
1679
|
+
throw new AdapterError('InternalError', `missing reinjection parameter name ${reinjectedParam.name} for operation ${method.name}`, (_a = method.__raw) === null || _a === void 0 ? void 0 : _a.node);
|
|
1680
|
+
}
|
|
1681
|
+
else if (rustParam.kind === 'headerScalar') {
|
|
1682
|
+
// we only care about the query params here.
|
|
1683
|
+
// any header parameters are handled elsewhere.
|
|
1684
|
+
continue;
|
|
1685
|
+
}
|
|
1686
|
+
paramsForReinjection.push(rustParam);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
return paramsForReinjection;
|
|
1690
|
+
}
|
|
1637
1691
|
/**
|
|
1638
1692
|
* converts a tcgc operation parameter into a Rust method parameter
|
|
1639
1693
|
*
|
|
@@ -1719,7 +1773,7 @@ export class Adapter {
|
|
|
1719
1773
|
adaptedParam = new rust.HeaderCollectionParameter(paramName, param.serializedName, paramLoc, param.optional, paramType, format);
|
|
1720
1774
|
}
|
|
1721
1775
|
else if (param.serializedName === 'x-ms-meta') {
|
|
1722
|
-
if (paramType.kind !== 'hashmap') {
|
|
1776
|
+
if (paramType.kind !== 'hashmap' && !isRefHashMap(paramType)) {
|
|
1723
1777
|
throw new AdapterError('InternalError', `unexpected kind ${paramType.kind} for header ${param.serializedName}`, (_d = param.__raw) === null || _d === void 0 ? void 0 : _d.node);
|
|
1724
1778
|
}
|
|
1725
1779
|
adaptedParam = new rust.HeaderHashMapParameter(paramName, param.serializedName, paramLoc, param.optional, paramType);
|
|
@@ -1753,7 +1807,7 @@ export class Adapter {
|
|
|
1753
1807
|
if (isRefSlice(paramType)) {
|
|
1754
1808
|
adaptedParam = new rust.PathCollectionParameter(paramName, param.serializedName, paramLoc, param.optional, paramType, param.allowReserved, style, param.explode);
|
|
1755
1809
|
}
|
|
1756
|
-
else if (paramType.kind === 'hashmap') {
|
|
1810
|
+
else if (paramType.kind === 'hashmap' || isRefHashMap(paramType)) {
|
|
1757
1811
|
adaptedParam = new rust.PathHashMapParameter(paramName, param.serializedName, paramLoc, param.optional, paramType, param.allowReserved, style, param.explode);
|
|
1758
1812
|
}
|
|
1759
1813
|
else {
|
|
@@ -1779,7 +1833,7 @@ export class Adapter {
|
|
|
1779
1833
|
// TODO: hard-coded encoding setting, https://github.com/Azure/typespec-azure/issues/1314
|
|
1780
1834
|
adaptedParam = new rust.QueryCollectionParameter(paramName, param.serializedName, paramLoc, param.optional, paramType, true, format);
|
|
1781
1835
|
}
|
|
1782
|
-
else if (paramType.kind === 'hashmap') {
|
|
1836
|
+
else if (paramType.kind === 'hashmap' || isRefHashMap(paramType)) {
|
|
1783
1837
|
// TODO: hard-coded encoding setting, https://github.com/Azure/typespec-azure/issues/1314
|
|
1784
1838
|
adaptedParam = new rust.QueryHashMapParameter(paramName, param.serializedName, paramLoc, param.optional, paramType, true, param.explode);
|
|
1785
1839
|
}
|
|
@@ -1851,6 +1905,16 @@ export class Adapter {
|
|
|
1851
1905
|
}
|
|
1852
1906
|
case 'encodedBytes':
|
|
1853
1907
|
return this.getRefType(this.getEncodedBytes(type.encoding, true));
|
|
1908
|
+
case 'decimal':
|
|
1909
|
+
case 'Etag':
|
|
1910
|
+
case 'hashmap':
|
|
1911
|
+
case 'jsonValue':
|
|
1912
|
+
case 'offsetDateTime':
|
|
1913
|
+
case 'safeint':
|
|
1914
|
+
case 'Url':
|
|
1915
|
+
// these types all require conversion
|
|
1916
|
+
// to String so we don't need to own them
|
|
1917
|
+
return this.getRefType(type);
|
|
1854
1918
|
}
|
|
1855
1919
|
return undefined;
|
|
1856
1920
|
}
|
|
@@ -1963,6 +2027,10 @@ export class Adapter {
|
|
|
1963
2027
|
}
|
|
1964
2028
|
}
|
|
1965
2029
|
}
|
|
2030
|
+
/** type guard to determine if type is a Ref<HashMap> */
|
|
2031
|
+
function isRefHashMap(type) {
|
|
2032
|
+
return shared.asTypeOf(type, 'hashmap', 'ref') !== undefined;
|
|
2033
|
+
}
|
|
1966
2034
|
/** type guard to determine if type is a Ref<Slice> */
|
|
1967
2035
|
function isRefSlice(type) {
|
|
1968
2036
|
return shared.asTypeOf(type, 'slice', 'ref') !== undefined;
|