@goast/typescript 0.2.11 → 0.2.12
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.
|
@@ -137,7 +137,11 @@ class DefaultTypeScriptEasyNetworkStubGenerator extends file_generator_1.TypeScr
|
|
|
137
137
|
let path = endpoint.path;
|
|
138
138
|
let isFirstQueryParam = true;
|
|
139
139
|
for (const param of endpoint.parameters) {
|
|
140
|
-
|
|
140
|
+
let type = ((_b = (param.schema && ((_a = ctx.input.models[param.schema.id]) === null || _a === void 0 ? void 0 : _a.component))) !== null && _b !== void 0 ? _b : ast_1.ts.refs.unknown.name).replace(/^readonly /, '');
|
|
141
|
+
const arrayMatch = /^\((.*)\)\[\]$/.exec(type);
|
|
142
|
+
if (arrayMatch !== null) {
|
|
143
|
+
type = `${arrayMatch[1]}[]`;
|
|
144
|
+
}
|
|
141
145
|
if (param.target === 'path') {
|
|
142
146
|
path = path.replace(`{${param.name}}`, `{${param.name}${param.required ? '' : '?'}:${type}}`);
|
|
143
147
|
}
|
|
@@ -134,7 +134,11 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
134
134
|
let path = endpoint.path;
|
|
135
135
|
let isFirstQueryParam = true;
|
|
136
136
|
for (const param of endpoint.parameters) {
|
|
137
|
-
|
|
137
|
+
let type = ((_b = (param.schema && ((_a = ctx.input.models[param.schema.id]) === null || _a === void 0 ? void 0 : _a.component))) !== null && _b !== void 0 ? _b : ts.refs.unknown.name).replace(/^readonly /, '');
|
|
138
|
+
const arrayMatch = /^\((.*)\)\[\]$/.exec(type);
|
|
139
|
+
if (arrayMatch !== null) {
|
|
140
|
+
type = `${arrayMatch[1]}[]`;
|
|
141
|
+
}
|
|
138
142
|
if (param.target === 'path') {
|
|
139
143
|
path = path.replace(`{${param.name}}`, `{${param.name}${param.required ? '' : '?'}:${type}}`);
|
|
140
144
|
}
|