api-core-lib 12.0.80 → 12.0.81
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/cli.cjs +10 -5
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -213,19 +213,24 @@ function parseSpecToModules(spec) {
|
|
|
213
213
|
const allEnums = /* @__PURE__ */ new Map();
|
|
214
214
|
const modulePaths = /* @__PURE__ */ new Map();
|
|
215
215
|
const registerSchema = (schema, baseName) => {
|
|
216
|
-
if (!schema) return "
|
|
216
|
+
if (!schema) return "Record<string, any>";
|
|
217
217
|
if (schema.type === "array" && schema.items) {
|
|
218
218
|
const itemSchema = schema.items;
|
|
219
219
|
const itemBaseName = `${baseName}Item`;
|
|
220
|
-
if (itemSchema.properties || itemSchema.type === "object")
|
|
221
|
-
|
|
220
|
+
if (itemSchema.properties || itemSchema.type === "object") {
|
|
221
|
+
return `${registerSchema(itemSchema, itemBaseName)}[]`;
|
|
222
|
+
}
|
|
223
|
+
const primitiveType = itemSchema.type === "integer" ? "number" : itemSchema.type || "any";
|
|
224
|
+
return `${primitiveType}[]`;
|
|
222
225
|
}
|
|
223
226
|
if (schema.type === "object" || schema.properties || schema.allOf || !schema.type) {
|
|
224
227
|
const typeName = toPascalCase(baseName.replace(/_v\d+(Request|Response)$/, "$1"));
|
|
225
|
-
if (!allSchemas.has(typeName))
|
|
228
|
+
if (!allSchemas.has(typeName)) {
|
|
229
|
+
allSchemas.set(typeName, parseSchema(typeName, schema, allEnums));
|
|
230
|
+
}
|
|
226
231
|
return typeName;
|
|
227
232
|
}
|
|
228
|
-
return schema.type === "integer" ? "number" : schema.type || "
|
|
233
|
+
return schema.type === "integer" ? "number" : schema.type || "any";
|
|
229
234
|
};
|
|
230
235
|
for (const apiPath in spec.paths) {
|
|
231
236
|
const pathItem = spec.paths[apiPath];
|