vovk 3.0.0-draft.369 → 3.0.0-draft.371
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.
|
@@ -59,16 +59,10 @@ function generateTypeScriptCode({ handlerName, rpcName, packageName, queryValida
|
|
|
59
59
|
}
|
|
60
60
|
return formSample;
|
|
61
61
|
};
|
|
62
|
-
const getBody = (schema) => {
|
|
63
|
-
if (schema['x-isForm']) {
|
|
64
|
-
return 'form';
|
|
65
|
-
}
|
|
66
|
-
return getTsFormSample(schema);
|
|
67
|
-
};
|
|
68
62
|
const tsArgs = hasArg
|
|
69
63
|
? `{
|
|
70
64
|
${[
|
|
71
|
-
bodyValidation ? ` body: ${
|
|
65
|
+
bodyValidation ? ` body: ${bodyValidation['x-isForm'] ? 'form' : getTsSample(bodyValidation)},` : null,
|
|
72
66
|
queryValidation ? ` query: ${getTsSample(queryValidation)},` : null,
|
|
73
67
|
paramsValidation ? ` params: ${getTsSample(paramsValidation)},` : null,
|
|
74
68
|
]
|
|
@@ -77,7 +71,7 @@ ${[
|
|
|
77
71
|
}`
|
|
78
72
|
: '';
|
|
79
73
|
const TS_CODE = `import { ${rpcName} } from '${packageName}';
|
|
80
|
-
|
|
74
|
+
${bodyValidation?.['x-isForm'] ? getTsFormSample(bodyValidation) : ''}
|
|
81
75
|
${iterationValidation ? 'using' : 'const'} response = await ${rpcName}.${handlerName}(${tsArgs});
|
|
82
76
|
${outputValidation
|
|
83
77
|
? `
|
|
@@ -125,7 +119,7 @@ function generatePythonCode({ handlerName, rpcName, packageName, queryValidation
|
|
|
125
119
|
}, []);
|
|
126
120
|
};
|
|
127
121
|
const pyFiles = bodyValidation ? getPyFiles(bodyValidation) : null;
|
|
128
|
-
const pyFilesArg = pyFiles?.length ? `${getIndentSpaces(4)}files=[\n${pyFiles.join('
|
|
122
|
+
const pyFilesArg = pyFiles?.length ? `${getIndentSpaces(4)}files=[\n${pyFiles.join(',\n')}\n]` : null;
|
|
129
123
|
const PY_CODE = `from ${packageName} import ${rpcName}
|
|
130
124
|
|
|
131
125
|
response = ${rpcName}.${handlerNameSnake}(${hasArg
|
|
@@ -59,16 +59,10 @@ function generateTypeScriptCode({ handlerName, rpcName, packageName, queryValida
|
|
|
59
59
|
}
|
|
60
60
|
return formSample;
|
|
61
61
|
};
|
|
62
|
-
const getBody = (schema) => {
|
|
63
|
-
if (schema['x-isForm']) {
|
|
64
|
-
return 'form';
|
|
65
|
-
}
|
|
66
|
-
return getTsFormSample(schema);
|
|
67
|
-
};
|
|
68
62
|
const tsArgs = hasArg
|
|
69
63
|
? `{
|
|
70
64
|
${[
|
|
71
|
-
bodyValidation ? ` body: ${
|
|
65
|
+
bodyValidation ? ` body: ${bodyValidation['x-isForm'] ? 'form' : getTsSample(bodyValidation)},` : null,
|
|
72
66
|
queryValidation ? ` query: ${getTsSample(queryValidation)},` : null,
|
|
73
67
|
paramsValidation ? ` params: ${getTsSample(paramsValidation)},` : null,
|
|
74
68
|
]
|
|
@@ -77,7 +71,7 @@ ${[
|
|
|
77
71
|
}`
|
|
78
72
|
: '';
|
|
79
73
|
const TS_CODE = `import { ${rpcName} } from '${packageName}';
|
|
80
|
-
|
|
74
|
+
${bodyValidation?.['x-isForm'] ? getTsFormSample(bodyValidation) : ''}
|
|
81
75
|
${iterationValidation ? 'using' : 'const'} response = await ${rpcName}.${handlerName}(${tsArgs});
|
|
82
76
|
${outputValidation
|
|
83
77
|
? `
|
|
@@ -125,7 +119,7 @@ function generatePythonCode({ handlerName, rpcName, packageName, queryValidation
|
|
|
125
119
|
}, []);
|
|
126
120
|
};
|
|
127
121
|
const pyFiles = bodyValidation ? getPyFiles(bodyValidation) : null;
|
|
128
|
-
const pyFilesArg = pyFiles?.length ? `${getIndentSpaces(4)}files=[\n${pyFiles.join('
|
|
122
|
+
const pyFilesArg = pyFiles?.length ? `${getIndentSpaces(4)}files=[\n${pyFiles.join(',\n')}\n]` : null;
|
|
129
123
|
const PY_CODE = `from ${packageName} import ${rpcName}
|
|
130
124
|
|
|
131
125
|
response = ${rpcName}.${handlerNameSnake}(${hasArg
|