@autorest/typescript 6.0.10 → 6.0.11
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/generators/samples/rlcSampleGenerator.d.ts +2 -5
- package/dist/src/generators/samples/rlcSampleGenerator.d.ts.map +1 -1
- package/dist/src/generators/samples/rlcSampleGenerator.js +29 -66
- package/dist/src/generators/samples/rlcSampleGenerator.js.map +1 -1
- package/dist/src/generators/static/packageFileGenerator.js +7 -6
- package/dist/src/generators/static/packageFileGenerator.js.map +1 -1
- package/dist/src/restLevelClient/generateRestLevel.d.ts.map +1 -1
- package/dist/src/restLevelClient/generateRestLevel.js +8 -8
- package/dist/src/restLevelClient/generateRestLevel.js.map +1 -1
- package/dist/src/restLevelClient/helpers/generatorHelpers.d.ts +1 -1
- package/dist/src/restLevelClient/helpers/generatorHelpers.d.ts.map +1 -1
- package/dist/src/restLevelClient/helpers/generatorHelpers.js +10 -5
- package/dist/src/restLevelClient/helpers/generatorHelpers.js.map +1 -1
- package/dist/src/restLevelClient/transforms/transform.d.ts.map +1 -1
- package/dist/src/restLevelClient/transforms/transform.js +6 -0
- package/dist/src/restLevelClient/transforms/transform.js.map +1 -1
- package/dist/src/restLevelClient/transforms/transformParameterTypes.d.ts +1 -0
- package/dist/src/restLevelClient/transforms/transformParameterTypes.d.ts.map +1 -1
- package/dist/src/restLevelClient/transforms/transformParameterTypes.js +18 -4
- package/dist/src/restLevelClient/transforms/transformParameterTypes.js.map +1 -1
- package/package.json +2 -2
- package/src/generators/samples/rlcSampleGenerator.ts +41 -57
- package/src/generators/static/packageFileGenerator.ts +7 -6
- package/src/restLevelClient/generateRestLevel.ts +8 -24
- package/src/restLevelClient/helpers/generatorHelpers.ts +13 -9
- package/src/restLevelClient/transforms/transform.ts +6 -0
- package/src/restLevelClient/transforms/transformParameterTypes.ts +35 -6
- package/dist/src/restLevelClient/interfaces.d.ts +0 -74
- package/dist/src/restLevelClient/interfaces.d.ts.map +0 -1
- package/dist/src/restLevelClient/interfaces.js +0 -5
- package/dist/src/restLevelClient/interfaces.js.map +0 -1
- package/src/restLevelClient/interfaces.ts +0 -96
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformParameterTypes.js","sourceRoot":"","sources":["../../../../src/restLevelClient/transforms/transformParameterTypes.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,mDAS6B;AAC7B,wDAOiC;AACjC,yDAAqD;AACrD,iEAAkE;AAClE,qDAAgE;AAChE,kEAAkD;AAClD,kEAAqE;AACrE,oDAAyE;AAEzE,SAAgB,uBAAuB,CACrC,KAAgB,EAChB,aAA2C;;IAE3C,MAAM,aAAa,GAAyB,EAAE,CAAC;IAC/C,IAAI,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC3C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,qEAAqE;QACrE,MAAM,aAAa,GAAG,IAAA,yBAAa,EACjC,IAAA,qCAAmB,EAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,IAAI,EAC5C,oBAAQ,CAAC,SAAS,CACnB,CAAC;QACF,MAAM,YAAY,GAAuB;YACvC,cAAc,EAAE,EAAE;YAClB,aAAa;YACb,UAAU,EAAE,EAAE;SACf,CAAC;QACF,MAAM,YAAY,GAAG,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,0CAAE,MAAM,mCAAI,CAAC,CAAC;QACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,UAAU,GAAG,IAAA,yCAAsB,EAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YACxD,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAA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AI,EAAE,aAAa;YACnB,KAAK,EAAE;gBACL,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;gBACjD,WAAW,EAAE,sBAAsB;gBACnC,QAAQ,EAAE,KAAK;aAChB;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAC9B,UAAuB,EACvB,cAA2B,EAC3B,gBAAqC;IAErC,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAC,OAAA,CAAA,MAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,0CAAE,EAAE,MAAK,MAAM,CAAA,EAAA,CAAC,CAAC;IAC9E,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QAC1B,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAChE,MAAM,YAAY,GAA0B;QAC1C,aAAa;KACd,CAAC;IACF,IAAI,aAAa,EAAE;QACjB,YAAY,CAAC,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAC1C,kBAAkB,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAChE,CAAC;KACH;SAAM;QACL,YAAY,CAAC,IAAI,GAAG;YAClB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"transformParameterTypes.js","sourceRoot":"","sources":["../../../../src/restLevelClient/transforms/transformParameterTypes.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,mDAS6B;AAC7B,wDAOiC;AACjC,yDAAqD;AACrD,iEAAkE;AAClE,qDAAgE;AAChE,kEAAkD;AAClD,kEAAqE;AACrE,oDAAyE;AAEzE,SAAgB,uBAAuB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
|
|
5
5
|
"./test-browser/utils/stream-helpers.js": "./test-browser/utils/stream-helpers.browser.js",
|
|
6
6
|
"./test-browser/utils/fileSystem.js": "./test-browser/utils/fileSystem.browser.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"source-map-support": "^0.5.16",
|
|
36
36
|
"ts-morph": "^15.1.0",
|
|
37
37
|
"@azure/core-auth": "^1.3.2",
|
|
38
|
-
"@azure-tools/rlc-common": "^0.17.
|
|
38
|
+
"@azure-tools/rlc-common": "^0.17.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@azure-tools/test-recorder": "^3.0.0",
|
|
@@ -2,42 +2,57 @@ import {
|
|
|
2
2
|
ExampleParameter,
|
|
3
3
|
TestCodeModel
|
|
4
4
|
} from "@autorest/testmodeler/dist/src/core/model";
|
|
5
|
-
import { Project } from "ts-morph";
|
|
6
5
|
import { getAutorestOptions, getSession } from "../../autorestSession";
|
|
7
|
-
import * as fs from "fs";
|
|
8
|
-
import * as path from "path";
|
|
9
|
-
import * as hbs from "handlebars";
|
|
10
6
|
import { NameType, normalizeName } from "../../utils/nameUtils";
|
|
11
7
|
import { getLanguageMetadata } from "../../utils/languageHelpers";
|
|
12
8
|
import { transformBaseUrl } from "../../transforms/urlTransforms";
|
|
13
|
-
import {
|
|
14
|
-
RLCSampleDetail,
|
|
15
|
-
RLCSampleGroup,
|
|
16
|
-
SampleParameter,
|
|
17
|
-
SampleParameters,
|
|
18
|
-
TestSampleParameters,
|
|
19
|
-
OperationMethod
|
|
20
|
-
} from "../../restLevelClient/interfaces";
|
|
21
9
|
import { camelCase } from "@azure-tools/codegen";
|
|
22
10
|
import { Operation, ParameterLocation } from "@autorest/codemodel";
|
|
23
11
|
import { isLongRunningOperation } from "../../restLevelClient/helpers/hasPollingOperations";
|
|
24
12
|
import { isPagingOperation } from "../../utils/extractPaginationDetails";
|
|
25
13
|
import { getSecurityInfoFromModel } from "../../utils/schemaHelpers";
|
|
26
14
|
import { getParameterAssignment } from "../../utils/valueHelpers";
|
|
27
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
Paths,
|
|
17
|
+
PathMetadata,
|
|
18
|
+
RLCSampleGroup,
|
|
19
|
+
RLCSampleDetail,
|
|
20
|
+
SampleParameter,
|
|
21
|
+
SampleParameters,
|
|
22
|
+
OperationMethod,
|
|
23
|
+
SampleParameterPosition,
|
|
24
|
+
transformSampleGroups as transformSampleGroupsFromMockValue,
|
|
25
|
+
RLCModel
|
|
26
|
+
} from "@azure-tools/rlc-common";
|
|
28
27
|
import { transformPaths } from "../../restLevelClient/transforms/transformPaths";
|
|
29
28
|
|
|
30
29
|
const tokenCredentialPackage = "@azure/identity";
|
|
31
30
|
const apiKeyCredentialPackage = "@azure/core-auth";
|
|
32
31
|
|
|
33
|
-
export
|
|
32
|
+
export function transformRLCSampleData(
|
|
33
|
+
model: TestCodeModel,
|
|
34
|
+
rlcModel: RLCModel
|
|
35
|
+
): RLCSampleGroup[] | undefined {
|
|
36
|
+
// We prefer to generate sample from swagger examples first
|
|
37
|
+
const sampleGroups = transformSampleGroupsFromSwaggerExamples(model);
|
|
38
|
+
if (sampleGroups && sampleGroups.length > 0) {
|
|
39
|
+
return sampleGroups;
|
|
40
|
+
}
|
|
41
|
+
const { generateSample, generateMetadata } = getAutorestOptions();
|
|
42
|
+
// If no swagger examples, we will generate mock sample
|
|
43
|
+
// Allow to generate mock sample when generateSample and generateMetadata are both true
|
|
44
|
+
const allowMockValue = generateSample === true && generateMetadata === true;
|
|
45
|
+
return transformSampleGroupsFromMockValue(rlcModel, allowMockValue);
|
|
46
|
+
}
|
|
34
47
|
|
|
35
|
-
|
|
48
|
+
function transformSampleGroupsFromSwaggerExamples(
|
|
49
|
+
model: TestCodeModel
|
|
50
|
+
): RLCSampleGroup[] | undefined {
|
|
36
51
|
const { generateSample, multiClient } = getAutorestOptions();
|
|
37
|
-
const session = getSession();
|
|
38
52
|
if (!generateSample || !model?.testModel?.mockTest?.exampleGroups) {
|
|
39
53
|
return;
|
|
40
54
|
}
|
|
55
|
+
const session = getSession();
|
|
41
56
|
// Currently only support single client
|
|
42
57
|
if (multiClient) {
|
|
43
58
|
session.info(
|
|
@@ -45,43 +60,11 @@ export function generateRLCSamples(model: TestCodeModel, project: Project) {
|
|
|
45
60
|
);
|
|
46
61
|
return;
|
|
47
62
|
}
|
|
48
|
-
const sampleGroups: RLCSampleGroup[] = transformRLCSampleData(model);
|
|
49
|
-
if (sampleGroups.length > 0) {
|
|
50
|
-
hasRLCSamplesGenerated = true;
|
|
51
|
-
}
|
|
52
|
-
for (const sampleGroup of sampleGroups) {
|
|
53
|
-
try {
|
|
54
|
-
const file = fs.readFileSync(path.join(__dirname, "rlcSamples.ts.hbs"), {
|
|
55
|
-
encoding: "utf-8"
|
|
56
|
-
});
|
|
57
|
-
const sampleGroupFileContents = hbs.compile(file, { noEscape: true });
|
|
58
|
-
project.createSourceFile(
|
|
59
|
-
`samples-dev/${sampleGroup.filename}.ts`,
|
|
60
|
-
sampleGroupFileContents(sampleGroup),
|
|
61
|
-
{
|
|
62
|
-
overwrite: true
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
} catch (error) {
|
|
66
|
-
session.error(
|
|
67
|
-
"An error was encountered while handling sample generation",
|
|
68
|
-
[sampleGroup.filename]
|
|
69
|
-
);
|
|
70
|
-
session.error(
|
|
71
|
-
"Stop generating samples and please inform the developers of codegen the detailed errors",
|
|
72
|
-
[]
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function transformRLCSampleData(model: TestCodeModel): RLCSampleGroup[] {
|
|
79
63
|
const rlcSampleGroups: RLCSampleGroup[] = [];
|
|
80
64
|
if (!model?.testModel?.mockTest?.exampleGroups) {
|
|
81
65
|
return rlcSampleGroups;
|
|
82
66
|
}
|
|
83
67
|
// Get all paths
|
|
84
|
-
const session = getSession();
|
|
85
68
|
const paths: Paths = transformPaths(model);
|
|
86
69
|
const clientName = getLanguageMetadata(model.language).name;
|
|
87
70
|
const clientInterfaceName = clientName.endsWith("Client")
|
|
@@ -134,7 +117,10 @@ export function transformRLCSampleData(model: TestCodeModel): RLCSampleGroup[] {
|
|
|
134
117
|
useLegacyLro: false
|
|
135
118
|
};
|
|
136
119
|
// convert the parameters to the intermidate model - SampleParameters
|
|
137
|
-
const rawParamters:
|
|
120
|
+
const rawParamters: Record<
|
|
121
|
+
SampleParameterPosition,
|
|
122
|
+
ExampleParameter[]
|
|
123
|
+
> = {
|
|
138
124
|
client: rawSample.clientParameters,
|
|
139
125
|
path: (rawSample.methodParameters || []).filter(isPathLevelParam),
|
|
140
126
|
method: (rawSample.methodParameters || []).filter(isMethodLevelParam)
|
|
@@ -149,8 +135,7 @@ export function transformRLCSampleData(model: TestCodeModel): RLCSampleGroup[] {
|
|
|
149
135
|
path: convertPathLevelParameters(rawParamters.path, pathDetail, path),
|
|
150
136
|
method: convertMethodLevelParameters(
|
|
151
137
|
rawParamters.method,
|
|
152
|
-
pathDetail.methods[method]
|
|
153
|
-
importedDict
|
|
138
|
+
pathDetail.methods[method]
|
|
154
139
|
)
|
|
155
140
|
};
|
|
156
141
|
// enrich parameter details
|
|
@@ -310,8 +295,7 @@ function convertPathLevelParameters(
|
|
|
310
295
|
|
|
311
296
|
function convertMethodLevelParameters(
|
|
312
297
|
rawMethodParams: ExampleParameter[],
|
|
313
|
-
methods: OperationMethod[]
|
|
314
|
-
importedDict: Record<string, Set<string>>
|
|
298
|
+
methods: OperationMethod[]
|
|
315
299
|
): SampleParameter[] {
|
|
316
300
|
if (!methods || methods.length == 0) {
|
|
317
301
|
return [];
|
|
@@ -369,9 +353,9 @@ function convertMethodLevelParameters(
|
|
|
369
353
|
}
|
|
370
354
|
const optionParam: SampleParameter = {
|
|
371
355
|
name: "options",
|
|
372
|
-
assignment: `const options
|
|
356
|
+
assignment: `const options =` + value + `;`,
|
|
357
|
+
value
|
|
373
358
|
};
|
|
374
|
-
addValueInImportedDict(getPackageName(), method.optionsName, importedDict);
|
|
375
359
|
return [optionParam];
|
|
376
360
|
}
|
|
377
361
|
|
|
@@ -383,8 +367,8 @@ function enrichParameterInSample(
|
|
|
383
367
|
sample.clientParamNames = getContactParameterNames(parameters.client);
|
|
384
368
|
sample.pathParamAssignments = getAssignmentStrArray(parameters.path);
|
|
385
369
|
sample.pathParamNames = getContactParameterNames(parameters.path);
|
|
386
|
-
sample.
|
|
387
|
-
|
|
370
|
+
sample.methodParamNames =
|
|
371
|
+
parameters.method.length > 0 ? parameters.method[0].value ?? "" : "";
|
|
388
372
|
}
|
|
389
373
|
|
|
390
374
|
function getAssignmentStrArray(parameters: SampleParameter[]) {
|
|
@@ -83,7 +83,7 @@ function regularAutorestPackage(
|
|
|
83
83
|
`A generated SDK for ${clientDetails.name}.`,
|
|
84
84
|
version: packageDetails.version,
|
|
85
85
|
engines: {
|
|
86
|
-
node: ">=
|
|
86
|
+
node: ">=16.0.0"
|
|
87
87
|
},
|
|
88
88
|
dependencies: {
|
|
89
89
|
...(hasLro && { "@azure/core-lro": "^2.5.4" }),
|
|
@@ -191,14 +191,16 @@ function regularAutorestPackage(
|
|
|
191
191
|
|
|
192
192
|
if (generateTest) {
|
|
193
193
|
packageInfo.module = `./dist-esm/src/index.js`;
|
|
194
|
-
packageInfo.devDependencies["@azure/identity"] = "^
|
|
194
|
+
packageInfo.devDependencies["@azure/identity"] = "^3.3.0";
|
|
195
195
|
packageInfo.devDependencies["@azure-tools/test-recorder"] = "^3.0.0";
|
|
196
196
|
packageInfo.devDependencies["@azure-tools/test-credential"] = "^1.0.0";
|
|
197
|
-
packageInfo.devDependencies["mocha"] = "^
|
|
197
|
+
packageInfo.devDependencies["mocha"] = "^10.0.0";
|
|
198
|
+
packageInfo.devDependencies["@types/mocha"] = "^10.0.0";
|
|
199
|
+
packageInfo.devDependencies["esm"] = "^3.2.18";
|
|
198
200
|
packageInfo.devDependencies["@types/chai"] = "^4.2.8";
|
|
199
201
|
packageInfo.devDependencies["chai"] = "^4.2.0";
|
|
200
202
|
packageInfo.devDependencies["cross-env"] = "^7.0.2";
|
|
201
|
-
packageInfo.devDependencies["@types/node"] = "^
|
|
203
|
+
packageInfo.devDependencies["@types/node"] = "^16.0.0";
|
|
202
204
|
packageInfo.devDependencies["ts-node"] = "^10.0.0";
|
|
203
205
|
|
|
204
206
|
packageInfo.scripts["test"] = "npm run integration-test";
|
|
@@ -214,8 +216,7 @@ function regularAutorestPackage(
|
|
|
214
216
|
packageInfo.scripts["integration-test:node"] =
|
|
215
217
|
"dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'";
|
|
216
218
|
} else {
|
|
217
|
-
packageInfo.scripts["integration-test:node"] =
|
|
218
|
-
"mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js";
|
|
219
|
+
packageInfo.scripts["integration-test:node"] = `cross-env TS_NODE_COMPILER_OPTIONS="{\\\"module\\\":\\\"commonjs\\\"}" mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts`;
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
if (
|
|
@@ -9,10 +9,6 @@ import { prettierJSONOptions, prettierTypeScriptOptions } from "./config";
|
|
|
9
9
|
import * as path from "path";
|
|
10
10
|
import * as fsextra from "fs-extra";
|
|
11
11
|
import { generateSampleEnv } from "../generators/samples/sampleEnvGenerator";
|
|
12
|
-
import {
|
|
13
|
-
generateRLCSamples,
|
|
14
|
-
hasRLCSamplesGenerated
|
|
15
|
-
} from "../generators/samples/rlcSampleGenerator";
|
|
16
12
|
import { transform } from "./transforms/transform";
|
|
17
13
|
import {
|
|
18
14
|
buildApiExtractorConfig,
|
|
@@ -36,7 +32,8 @@ import {
|
|
|
36
32
|
buildLicenseFile,
|
|
37
33
|
buildReadmeFile,
|
|
38
34
|
buildSerializeHelper,
|
|
39
|
-
buildLogger
|
|
35
|
+
buildLogger,
|
|
36
|
+
buildSamples
|
|
40
37
|
} from "@azure-tools/rlc-common";
|
|
41
38
|
import {
|
|
42
39
|
generateFileByBuilder,
|
|
@@ -53,7 +50,6 @@ export async function generateRestLevelClient() {
|
|
|
53
50
|
const {
|
|
54
51
|
outputPath,
|
|
55
52
|
srcPath,
|
|
56
|
-
generateSample,
|
|
57
53
|
generateTest,
|
|
58
54
|
generateMetadata
|
|
59
55
|
} = getAutorestOptions();
|
|
@@ -70,6 +66,7 @@ export async function generateRestLevelClient() {
|
|
|
70
66
|
|
|
71
67
|
// then transform CodeModel to RLCModel
|
|
72
68
|
const rlcModels = transform(model);
|
|
69
|
+
const hasSampleGenerated = (rlcModels.sampleGroups ?? []).length > 0;
|
|
73
70
|
|
|
74
71
|
if (generateMetadata) {
|
|
75
72
|
// buildReadmeFile
|
|
@@ -118,31 +115,18 @@ export async function generateRestLevelClient() {
|
|
|
118
115
|
generateFileByBuilder(project, buildSerializeHelper, rlcModels);
|
|
119
116
|
generateFileByBuilder(project, buildLogger, rlcModels);
|
|
120
117
|
generateTopLevelIndexFile(rlcModels, project);
|
|
121
|
-
if (
|
|
122
|
-
|
|
118
|
+
if (hasSampleGenerated && generateMetadata) {
|
|
119
|
+
generateFileByBuilder(project, buildSamples, rlcModels);
|
|
123
120
|
}
|
|
124
|
-
if (
|
|
125
|
-
((generateSample && hasRLCSamplesGenerated) || generateTest) &&
|
|
126
|
-
generateMetadata
|
|
127
|
-
) {
|
|
121
|
+
if ((hasSampleGenerated || generateTest) && generateMetadata) {
|
|
128
122
|
generateSampleEnv(project);
|
|
129
123
|
}
|
|
130
124
|
|
|
131
125
|
if (generateMetadata) {
|
|
132
126
|
// buildPackageFile
|
|
133
|
-
generateFileByBuilder(
|
|
134
|
-
project,
|
|
135
|
-
buildPackageFile,
|
|
136
|
-
rlcModels,
|
|
137
|
-
hasRLCSamplesGenerated
|
|
138
|
-
);
|
|
127
|
+
generateFileByBuilder(project, buildPackageFile, rlcModels);
|
|
139
128
|
// buildTsConfig
|
|
140
|
-
generateFileByBuilder(
|
|
141
|
-
project,
|
|
142
|
-
buildTsConfig,
|
|
143
|
-
rlcModels,
|
|
144
|
-
hasRLCSamplesGenerated
|
|
145
|
-
);
|
|
129
|
+
generateFileByBuilder(project, buildTsConfig, rlcModels);
|
|
146
130
|
}
|
|
147
131
|
|
|
148
132
|
// Save the source files to the virtual filesystem
|
|
@@ -9,18 +9,13 @@ import { buildSchemaTypes } from "@azure-tools/rlc-common";
|
|
|
9
9
|
export function generateFileByBuilder(
|
|
10
10
|
project: Project,
|
|
11
11
|
buildFnOrList: ContentBuilder | ContentBuilder[],
|
|
12
|
-
rlcModels: RLCModel
|
|
13
|
-
hasSampleGenerated?: boolean
|
|
12
|
+
rlcModels: RLCModel
|
|
14
13
|
) {
|
|
15
14
|
if (!Array.isArray(buildFnOrList)) {
|
|
16
15
|
buildFnOrList = [buildFnOrList];
|
|
17
16
|
}
|
|
18
17
|
for (const buildFn of buildFnOrList) {
|
|
19
|
-
|
|
20
|
-
rlcModels,
|
|
21
|
-
hasSampleGenerated
|
|
22
|
-
);
|
|
23
|
-
generateFile(preparedFile, project);
|
|
18
|
+
generateFile(buildFn(rlcModels), project);
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
21
|
|
|
@@ -30,8 +25,17 @@ export function generateSchemaTypes(project: Project, rlcModels: RLCModel) {
|
|
|
30
25
|
generateFile(outputModelFile, project);
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
function generateFile(
|
|
34
|
-
|
|
28
|
+
function generateFile(
|
|
29
|
+
files: RLCFile[] | RLCFile | undefined,
|
|
30
|
+
project: Project
|
|
31
|
+
) {
|
|
32
|
+
if (!files) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!Array.isArray(files)) {
|
|
36
|
+
files = [files];
|
|
37
|
+
}
|
|
38
|
+
for (const file of files) {
|
|
35
39
|
project.createSourceFile(file.path, file.content, {
|
|
36
40
|
overwrite: true
|
|
37
41
|
});
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
import { transformPaths } from "./transformPaths";
|
|
35
35
|
import { transformResponseTypes } from "./transformResponseTypes";
|
|
36
36
|
import { transformSchemas } from "./transformSchemas";
|
|
37
|
+
import { transformRLCSampleData } from "../../generators/samples/rlcSampleGenerator";
|
|
37
38
|
|
|
38
39
|
export function transform(model: CodeModel): RLCModel {
|
|
39
40
|
const { srcPath } = getAutorestOptions();
|
|
@@ -55,6 +56,7 @@ export function transform(model: CodeModel): RLCModel {
|
|
|
55
56
|
urlInfo: transformUrlInfo(model),
|
|
56
57
|
apiVersionInfo: transformApiVersion(model, urlInfo)
|
|
57
58
|
};
|
|
59
|
+
rlcModel.sampleGroups = transformRLCSampleData(model, rlcModel);
|
|
58
60
|
return rlcModel;
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -125,6 +127,7 @@ export function transformHelperDetails(
|
|
|
125
127
|
let hasPipeCollection = false;
|
|
126
128
|
let hasSsvCollection = false;
|
|
127
129
|
let hasTsvCollection = false;
|
|
130
|
+
let hasCsvCollection = false;
|
|
128
131
|
for (let operationGroup of model.operationGroups) {
|
|
129
132
|
for (let operation of operationGroup.operations) {
|
|
130
133
|
const paginationDetails = extractPaginationDetails(operation);
|
|
@@ -147,6 +150,9 @@ export function transformHelperDetails(
|
|
|
147
150
|
hasTsvCollection = hasTsvCollection
|
|
148
151
|
? hasTsvCollection
|
|
149
152
|
: serializeInfo.hasTsvCollection;
|
|
153
|
+
hasCsvCollection = hasCsvCollection
|
|
154
|
+
? hasCsvCollection
|
|
155
|
+
: serializeInfo.hasCsvCollection;
|
|
150
156
|
});
|
|
151
157
|
}
|
|
152
158
|
}
|
|
@@ -171,7 +171,12 @@ function transformBodyParameters(
|
|
|
171
171
|
);
|
|
172
172
|
} else {
|
|
173
173
|
rlcBodyParam.body = [
|
|
174
|
-
getParameterSchema(
|
|
174
|
+
getParameterSchema(
|
|
175
|
+
bodyParameters[0],
|
|
176
|
+
importedModels,
|
|
177
|
+
false,
|
|
178
|
+
contentTypeParam
|
|
179
|
+
)
|
|
175
180
|
];
|
|
176
181
|
}
|
|
177
182
|
|
|
@@ -244,9 +249,23 @@ function getParameterSchema(
|
|
|
244
249
|
}
|
|
245
250
|
if (type === "Array<string>" || type === "Array<number>") {
|
|
246
251
|
const serializeInfo = getSpecialSerializeInfo(parameter);
|
|
247
|
-
if (
|
|
252
|
+
if (
|
|
253
|
+
serializeInfo.hasMultiCollection ||
|
|
254
|
+
serializeInfo.hasPipeCollection ||
|
|
255
|
+
serializeInfo.hasSsvCollection ||
|
|
256
|
+
serializeInfo.hasTsvCollection ||
|
|
257
|
+
serializeInfo.hasCsvCollection
|
|
258
|
+
) {
|
|
248
259
|
type = "string";
|
|
249
|
-
description += ` This parameter needs to be formatted as ${serializeInfo.collectionInfo.join(
|
|
260
|
+
description += ` This parameter needs to be formatted as ${serializeInfo.collectionInfo.join(
|
|
261
|
+
", "
|
|
262
|
+
)} collection, we provide ${serializeInfo.descriptions.join(
|
|
263
|
+
", "
|
|
264
|
+
)} from serializeHelper.ts to help${
|
|
265
|
+
serializeInfo.hasMultiCollection
|
|
266
|
+
? ", you will probably need to set skipUrlEncoding as true when sending the request"
|
|
267
|
+
: ""
|
|
268
|
+
}`;
|
|
250
269
|
}
|
|
251
270
|
}
|
|
252
271
|
return {
|
|
@@ -262,9 +281,13 @@ export function getSpecialSerializeInfo(parameter: Parameter) {
|
|
|
262
281
|
let hasPipeCollection = false;
|
|
263
282
|
let hasSsvCollection = false;
|
|
264
283
|
let hasTsvCollection = false;
|
|
284
|
+
let hasCsvCollection = false;
|
|
265
285
|
const descriptions = [];
|
|
266
286
|
const collectionInfo = [];
|
|
267
|
-
if (
|
|
287
|
+
if (
|
|
288
|
+
parameter.protocol.http?.explode === true &&
|
|
289
|
+
parameter.protocol.http?.style === "form"
|
|
290
|
+
) {
|
|
268
291
|
hasMultiCollection = true;
|
|
269
292
|
descriptions.push("buildMultiCollection");
|
|
270
293
|
collectionInfo.push("multi");
|
|
@@ -284,14 +307,20 @@ export function getSpecialSerializeInfo(parameter: Parameter) {
|
|
|
284
307
|
descriptions.push("buildTsvCollection");
|
|
285
308
|
collectionInfo.push("tsv");
|
|
286
309
|
}
|
|
310
|
+
if (parameter.protocol.http?.style === "simple") {
|
|
311
|
+
hasCsvCollection = true;
|
|
312
|
+
descriptions.push("buildCsvCollection");
|
|
313
|
+
collectionInfo.push("csv");
|
|
314
|
+
}
|
|
287
315
|
return {
|
|
288
316
|
hasMultiCollection,
|
|
289
317
|
hasPipeCollection,
|
|
290
318
|
hasSsvCollection,
|
|
291
319
|
hasTsvCollection,
|
|
320
|
+
hasCsvCollection,
|
|
292
321
|
descriptions,
|
|
293
322
|
collectionInfo
|
|
294
|
-
}
|
|
323
|
+
};
|
|
295
324
|
}
|
|
296
325
|
|
|
297
326
|
/**
|
|
@@ -304,4 +333,4 @@ function getAllOperations(model: CodeModel): Operation[] {
|
|
|
304
333
|
}
|
|
305
334
|
|
|
306
335
|
return operations;
|
|
307
|
-
}
|
|
336
|
+
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Schema } from "@autorest/codemodel";
|
|
2
|
-
import { ExampleParameter } from "@autorest/testmodeler/dist/src/core/model";
|
|
3
|
-
export type PathParameter = {
|
|
4
|
-
name: string;
|
|
5
|
-
schema: Schema;
|
|
6
|
-
description?: string;
|
|
7
|
-
};
|
|
8
|
-
export interface ResponseTypes {
|
|
9
|
-
success: string[];
|
|
10
|
-
error: string[];
|
|
11
|
-
}
|
|
12
|
-
export interface OperationMethod {
|
|
13
|
-
optionsName: string;
|
|
14
|
-
description: string;
|
|
15
|
-
hasOptionalOptions: boolean;
|
|
16
|
-
returnType: string;
|
|
17
|
-
successStatus: string[];
|
|
18
|
-
responseTypes: ResponseTypes;
|
|
19
|
-
}
|
|
20
|
-
export type Methods = {
|
|
21
|
-
[key: string]: [OperationMethod];
|
|
22
|
-
};
|
|
23
|
-
export interface PathMetadata {
|
|
24
|
-
name: string;
|
|
25
|
-
pathParameters: PathParameter[];
|
|
26
|
-
methods: Methods;
|
|
27
|
-
annotations?: OperationAnnotations;
|
|
28
|
-
}
|
|
29
|
-
export type Paths = Record<string, PathMetadata>;
|
|
30
|
-
export interface OperationAnnotations {
|
|
31
|
-
isLongRunning?: boolean;
|
|
32
|
-
isPageable?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A group of samples in operation_id level and they are used to generate in a sample file
|
|
36
|
-
*/
|
|
37
|
-
export interface RLCSampleGroup {
|
|
38
|
-
filename: string;
|
|
39
|
-
clientPackageName: string;
|
|
40
|
-
defaultFactoryName: string;
|
|
41
|
-
samples: RLCSampleDetail[];
|
|
42
|
-
importedTypes?: string[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* An independent sample detail and it will be wrapped as a func
|
|
46
|
-
*/
|
|
47
|
-
export interface RLCSampleDetail {
|
|
48
|
-
/**
|
|
49
|
-
* metadata for comments
|
|
50
|
-
*/
|
|
51
|
-
description: string;
|
|
52
|
-
originalFileLocation?: string;
|
|
53
|
-
name: string;
|
|
54
|
-
path: string;
|
|
55
|
-
defaultFactoryName: string;
|
|
56
|
-
clientParamAssignments: string[];
|
|
57
|
-
pathParamAssignments: string[];
|
|
58
|
-
methodParamAssignments: string[];
|
|
59
|
-
clientParamNames: string;
|
|
60
|
-
pathParamNames: string;
|
|
61
|
-
methodParamNames: "options" | "";
|
|
62
|
-
method: string;
|
|
63
|
-
isLRO: boolean;
|
|
64
|
-
isPaging: boolean;
|
|
65
|
-
useLegacyLro: boolean;
|
|
66
|
-
}
|
|
67
|
-
export type SampleParameterPosition = "client" | "path" | "method";
|
|
68
|
-
export type SampleParameters = Record<SampleParameterPosition, SampleParameter[]>;
|
|
69
|
-
export type TestSampleParameters = Record<SampleParameterPosition, ExampleParameter[]>;
|
|
70
|
-
export interface SampleParameter {
|
|
71
|
-
name: string;
|
|
72
|
-
assignment?: string;
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=interf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