hono-takibi 0.21.0 → 0.23.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/cli.js CHANGED
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { l as INPUT_EXTENSIONS } from "./constants-Bz8YiPum.js";
3
- import { NodeRuntime, NodeServices } from "@effect/platform-node";
3
+ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
4
+ import * as NodeServices from "@effect/platform-node/NodeServices";
4
5
  import { Console, Effect, FileSystem, Option, Path, Ref, Schema, Stream } from "effect";
5
6
  import { Argument, CliError, Command, Flag } from "effect/cli";
6
7
  //#region package.json
7
- var version = "0.21.0";
8
+ var version = "0.23.0";
8
9
  var description = "Hono Takibi is a code generator from OpenAPI to @hono/zod-openapi";
9
10
  //#endregion
10
11
  //#region src/cli/index.ts
@@ -39,9 +40,9 @@ function loadConfig(configPath, reload) {
39
40
  function runJobs(config) {
40
41
  return Effect.gen(function* () {
41
42
  const [{ parseOpenAPI }, { FormatOptions }, { cleanSplitOutputs, makeJob, packageRoots }] = yield* Effect.promise(() => Promise.all([
42
- import("./openapi-DQRxq2_O.js").then((n) => n.t),
43
+ import("./openapi-DEZCoJlc.js").then((n) => n.t),
43
44
  import("./format-CuHABcKC.js").then((n) => n.r),
44
- import("./shared-COpMVRhG.js").then((n) => n.a)
45
+ import("./shared-BxcbHfBt.js").then((n) => n.a)
45
46
  ]));
46
47
  const openAPI = yield* parseOpenAPI(config.input);
47
48
  const jobs = makeJob(openAPI, config, yield* packageRoots(openAPI, config));
@@ -79,7 +80,7 @@ function reportJobs(config, previous) {
79
80
  onFailure: (error) => Console.error(`❌ ${error.message}`),
80
81
  onSuccess: (report) => Console.log(report)
81
82
  }));
82
- const { outsideSources } = yield* Effect.promise(() => import("./shared-COpMVRhG.js").then((n) => n.a));
83
+ const { outsideSources } = yield* Effect.promise(() => import("./shared-BxcbHfBt.js").then((n) => n.a));
83
84
  const inputDirectory = path.dirname(path.resolve(config.input));
84
85
  return {
85
86
  inputDirectory,
@@ -206,7 +207,7 @@ function generate(args) {
206
207
  })]
207
208
  });
208
209
  if (input !== void 0 && output !== void 0) {
209
- const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-DQRxq2_O.js").then((n) => n.t), import("./core-BDhKAR3A.js").then((n) => n.t)]));
210
+ const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-DEZCoJlc.js").then((n) => n.t), import("./core-BhMCMrQ6.js").then((n) => n.t)]));
210
211
  return yield* Console.log(yield* takibi(yield* parseOpenAPI(input), output));
211
212
  }
212
213
  const resolvedConfig = configPath ?? DEFAULT_CONFIG_FILE;
@@ -1,2 +1 @@
1
- import { t as docs } from "../../docs-Im22cNpx.js";
2
- export { docs };
1
+ export { t as docs } from "../../docs-C5t1NRQ8.js";
@@ -167,4 +167,5 @@ export declare function hooks(openAPI: OpenAPI, output: string, importPath: stri
167
167
  readonly grouping?: Grouping;
168
168
  readonly basePath?: string;
169
169
  }): import("effect/Effect").Effect<`Generated ${string} hooks written to ${string}`, FormatError | GenerateError | import("effect/PlatformError").PlatformError, import("effect/FileSystem").FileSystem>;
170
- //#endregion
170
+ //#endregion
171
+ export {};
@@ -1,2 +1 @@
1
- import { t as hooks } from "../../hooks-CR7angVC.js";
2
- export { hooks };
1
+ export { t as hooks } from "../../hooks-CR7angVC.js";
@@ -1,5 +1,5 @@
1
1
  import "../../constants-Bz8YiPum.js";
2
- import { B as isParameter, F as isMediaWithSchema, L as isOpenAPIPaths, Q as isSchemaArray, R as isOperation, V as isParameterArray, X as isRequestBody, g as statusCodeToNumber, it as isStringRef, j as isHttpMethod, u as makeSafeKey } from "../../utils-vw99OasL.js";
2
+ import { B as isParameter, F as isMediaWithSchema, L as isOpenAPIPaths, Q as isSchemaArray, R as isOperation, V as isParameterArray, X as isRequestBody, _ as toIdentifierPascalCase, g as statusCodeToNumber, it as isStringRef, j as isHttpMethod, u as makeSafeKey } from "../../utils-vw99OasL.js";
3
3
  import { t as emit } from "../../emit-uwlZZeRM.js";
4
4
  import { Effect } from "effect";
5
5
  import path from "node:path";
@@ -9,19 +9,49 @@ import path from "node:path";
9
9
  */
10
10
  const DEEP_READONLY_TYPE = "type DeepReadonly<T>=T extends(infer R)[]?readonly DeepReadonly<R>[]:T extends object?{readonly[K in keyof T]:DeepReadonly<T[K]>}:T;";
11
11
  /**
12
+ * The type names the declaration file uses for itself and for what it refers to; a
13
+ * component schema that would take one of them is given another name.
14
+ */
15
+ const RESERVED_TYPE_NAMES = /* @__PURE__ */ new Set(["DeepReadonly", "File"]);
16
+ /**
12
17
  * Generates TypeScript type declarations from OpenAPI specification.
13
18
  */
14
19
  function type(openAPI, output, readonly) {
15
- const schemaType = makeHonoSchemaType(openAPI);
20
+ const aliases = {
21
+ components: openAPI.components,
22
+ names: /* @__PURE__ */ new Map(),
23
+ bodies: /* @__PURE__ */ new Map(),
24
+ taken: new Set(RESERVED_TYPE_NAMES)
25
+ };
26
+ const schemaType = makeHonoSchemaType(openAPI, aliases);
16
27
  const wrappedType = readonly ? `DeepReadonly<${schemaType}>` : schemaType;
17
- const dts = `${readonly ? DEEP_READONLY_TYPE : ""}declare const routes:import('@hono/zod-openapi').OpenAPIHono<import('hono/types').Env,${wrappedType},'/'>\nexport default routes\n`;
28
+ const dts = `${readonly ? DEEP_READONLY_TYPE : ""}${[...aliases.bodies].map(([name, body]) => `type ${name}=${body};`).join("")}declare const routes:import('@hono/zod-openapi').OpenAPIHono<import('hono/types').Env,${wrappedType},'/'>\nexport default routes\n`;
18
29
  return Effect.gen(function* () {
19
30
  yield* emit(dts, path.dirname(output), output);
20
31
  return `Generated type code written to ${output}`;
21
32
  });
22
33
  }
23
- function makeHonoSchemaType(openAPI) {
24
- const { components } = openAPI;
34
+ /**
35
+ * The alias that stands for the component schema `schemaName`, written when it is not
36
+ * yet. The name is claimed before the body is written, so that a schema reaching
37
+ * itself finds its own name.
38
+ */
39
+ function aliasOf(schemaName, schema, aliases) {
40
+ const known = aliases.names.get(schemaName);
41
+ if (known !== void 0) return known;
42
+ const base = toIdentifierPascalCase(schemaName);
43
+ const name = aliases.taken.has(base) ? (() => {
44
+ let index = 2;
45
+ while (aliases.taken.has(`${base}${String(index)}`)) index += 1;
46
+ return `${base}${String(index)}`;
47
+ })() : base;
48
+ aliases.taken.add(name);
49
+ aliases.names.set(schemaName, name);
50
+ const body = makeSchemaTypeString(schema, aliases, /* @__PURE__ */ new Set([`#/components/schemas/${schemaName}`]));
51
+ aliases.bodies.set(name, body);
52
+ return name;
53
+ }
54
+ function makeHonoSchemaType(openAPI, aliases) {
25
55
  const paths = isOpenAPIPaths(openAPI.paths) ? openAPI.paths : {};
26
56
  const pathEntries = Object.entries(paths).flatMap(([openApiPath, pathItem]) => {
27
57
  const honoPath = makeHonoPath(openApiPath);
@@ -31,7 +61,7 @@ function makeHonoSchemaType(openAPI) {
31
61
  return isHttpMethod(method) && isOperation(op);
32
62
  }).map(([method, operation]) => ({
33
63
  method: `$${method}`,
34
- type: makeMethodType(operation, openApiPath, components, pathLevelParams)
64
+ type: makeMethodType(operation, openApiPath, aliases, pathLevelParams)
35
65
  }));
36
66
  return methods.length > 0 ? [{
37
67
  path: honoPath,
@@ -43,75 +73,76 @@ function makeHonoSchemaType(openAPI) {
43
73
  function makeHonoPath(openApiPath) {
44
74
  return openApiPath.replaceAll(/\{([^}]+)\}/gu, ":$1");
45
75
  }
46
- function makeMethodType(operation, openApiPath, components, pathLevelParams) {
47
- const inputType = makeInputType(operation, openApiPath, components, pathLevelParams);
48
- const outputTypes = makeOutputTypes(operation.responses, components, inputType);
76
+ function makeMethodType(operation, openApiPath, aliases, pathLevelParams) {
77
+ const inputType = makeInputType(operation, openApiPath, aliases, pathLevelParams);
78
+ const outputTypes = makeOutputTypes(operation.responses, aliases, inputType);
49
79
  return outputTypes.length === 0 ? `{input:${inputType};output:{};outputFormat:string;status:200}` : outputTypes.length === 1 ? outputTypes[0] : outputTypes.join("|");
50
80
  }
51
- function makeInputType(operation, openApiPath, components, pathLevelParams) {
81
+ function makeInputType(operation, openApiPath, aliases, pathLevelParams) {
82
+ const { components } = aliases;
52
83
  const pathLevelResolved = pathLevelParams.map((p) => makeResolvedParameter(p, components)).filter((p) => p !== void 0);
53
84
  const operationLevelResolved = (operation.parameters ?? []).map((p) => makeResolvedParameter(p, components)).filter((p) => p !== void 0);
54
85
  const operationParamNames = new Set(operationLevelResolved.map((p) => p.name));
55
86
  const resolvedParams = [...operationLevelResolved, ...pathLevelResolved.filter((p) => !operationParamNames.has(p.name))];
56
87
  const parts = [
57
- makePathParams(openApiPath).length > 0 ? makeParamPart(resolvedParams.filter((p) => p.in === "path"), components) : void 0,
58
- makeQueryPart(resolvedParams.filter((p) => p.in === "query"), components),
59
- makeHeaderPart(resolvedParams.filter((p) => p.in === "header"), components),
60
- makeCookiePart(resolvedParams.filter((p) => p.in === "cookie"), components),
61
- ...makeBodyParts(operation.requestBody, components)
88
+ makePathParams(openApiPath).length > 0 ? makeParamPart(resolvedParams.filter((p) => p.in === "path"), aliases) : void 0,
89
+ makeQueryPart(resolvedParams.filter((p) => p.in === "query"), aliases),
90
+ makeHeaderPart(resolvedParams.filter((p) => p.in === "header"), aliases),
91
+ makeCookiePart(resolvedParams.filter((p) => p.in === "cookie"), aliases),
92
+ ...makeBodyParts(operation.requestBody, aliases)
62
93
  ].filter((p) => p !== void 0);
63
94
  return parts.length === 0 ? "{}" : parts.join("&");
64
95
  }
65
96
  function makePathParams(openApiPath) {
66
97
  return [...openApiPath.matchAll(/\{([^}]+)\}/gu)].map((m) => m[1]);
67
98
  }
68
- function makeParamPart(params, components) {
99
+ function makeParamPart(params, aliases) {
69
100
  const props = params.map((p) => {
70
- return `${makeSafeKey(p.name)}:${makeSchemaTypeString(makeParameterSchema(p), components, /* @__PURE__ */ new Set())}`;
101
+ return `${makeSafeKey(p.name)}:${makeSchemaTypeString(makeParameterSchema(p), aliases, /* @__PURE__ */ new Set())}`;
71
102
  });
72
103
  return props.length > 0 ? `{param:{${props.join(";")}}}` : void 0;
73
104
  }
74
- function makeQueryPart(params, components) {
105
+ function makeQueryPart(params, aliases) {
75
106
  const props = params.map((p) => {
76
- const typeStr = makeSchemaTypeString(makeParameterSchema(p), components, /* @__PURE__ */ new Set());
107
+ const typeStr = makeSchemaTypeString(makeParameterSchema(p), aliases, /* @__PURE__ */ new Set());
77
108
  const safeKey = makeSafeKey(p.name);
78
109
  return p.required ? `${safeKey}:${typeStr}` : `${safeKey}?:${typeStr}|undefined`;
79
110
  });
80
111
  return props.length > 0 ? `{query:{${props.join(";")}}}` : void 0;
81
112
  }
82
- function makeHeaderPart(params, components) {
113
+ function makeHeaderPart(params, aliases) {
83
114
  const props = params.map((p) => {
84
- const typeStr = makeSchemaTypeString(makeParameterSchema(p), components, /* @__PURE__ */ new Set());
115
+ const typeStr = makeSchemaTypeString(makeParameterSchema(p), aliases, /* @__PURE__ */ new Set());
85
116
  const safeKey = makeSafeKey(p.name);
86
117
  return p.required ? `${safeKey}:${typeStr}` : `${safeKey}?:${typeStr}|undefined`;
87
118
  });
88
119
  return props.length > 0 ? `{header:{${props.join(";")}}}` : void 0;
89
120
  }
90
- function makeCookiePart(params, components) {
121
+ function makeCookiePart(params, aliases) {
91
122
  const props = params.map((p) => {
92
- const typeStr = makeSchemaTypeString(makeParameterSchema(p), components, /* @__PURE__ */ new Set());
123
+ const typeStr = makeSchemaTypeString(makeParameterSchema(p), aliases, /* @__PURE__ */ new Set());
93
124
  const safeKey = makeSafeKey(p.name);
94
125
  return p.required ? `${safeKey}:${typeStr}` : `${safeKey}?:${typeStr}|undefined`;
95
126
  });
96
127
  return props.length > 0 ? `{cookie:{${props.join(";")}}}` : void 0;
97
128
  }
98
- function makeBodyParts(requestBody, components) {
99
- const resolved = requestBody ? makeResolvedRequestBody(requestBody, components) : void 0;
129
+ function makeBodyParts(requestBody, aliases) {
130
+ const resolved = requestBody ? makeResolvedRequestBody(requestBody, aliases.components) : void 0;
100
131
  if (!resolved?.content) return [];
101
132
  const mediaEntries = Object.entries(resolved.content).filter((entry) => isMediaWithSchema(entry[1]));
102
133
  const classified = {
103
- jsonTypes: [...new Set(mediaEntries.filter(([mediaType]) => mediaType.includes("json") || mediaType.startsWith("application/") || mediaType.startsWith("text/")).map(([, media]) => makeSchemaTypeString(media.schema, components, /* @__PURE__ */ new Set())))],
104
- formTypes: [...new Set(mediaEntries.filter(([mediaType]) => mediaType.includes("form")).map(([, media]) => makeSchemaTypeString(media.schema, components, /* @__PURE__ */ new Set())))]
134
+ jsonTypes: [...new Set(mediaEntries.filter(([mediaType]) => mediaType.includes("json") || mediaType.startsWith("application/") || mediaType.startsWith("text/")).map(([, media]) => makeSchemaTypeString(media.schema, aliases, /* @__PURE__ */ new Set())))],
135
+ formTypes: [...new Set(mediaEntries.filter(([mediaType]) => mediaType.includes("form")).map(([, media]) => makeSchemaTypeString(media.schema, aliases, /* @__PURE__ */ new Set())))]
105
136
  };
106
137
  return [classified.jsonTypes.length > 0 ? `{json:${classified.jsonTypes.length === 1 ? classified.jsonTypes[0] : `(${classified.jsonTypes.join("|")})`}}` : void 0, classified.formTypes.length > 0 ? `{form:${classified.formTypes.length === 1 ? classified.formTypes[0] : `(${classified.formTypes.join("|")})`}}` : void 0].filter((p) => p !== void 0);
107
138
  }
108
- function makeOutputTypes(responses, components, inputType) {
139
+ function makeOutputTypes(responses, aliases, inputType) {
109
140
  return Object.entries(responses).flatMap(([statusCode, response]) => {
110
- const resolvedResponse = makeResolvedResponse(response, components);
141
+ const resolvedResponse = makeResolvedResponse(response, aliases.components);
111
142
  const status = statusCodeToNumber(statusCode);
112
143
  if (!resolvedResponse.content) return [`{input:${inputType};output:{};outputFormat:string;status:${status}}`];
113
144
  return Object.entries(resolvedResponse.content).filter((entry) => isMediaWithSchema(entry[1])).map(([mediaType, media]) => {
114
- return `{input:${inputType};output:${makeSchemaTypeString(media.schema, components, /* @__PURE__ */ new Set())};outputFormat:${isJsonMediaType(mediaType) ? "'json'" : "'text'"};status:${status}}`;
145
+ return `{input:${inputType};output:${makeSchemaTypeString(media.schema, aliases, /* @__PURE__ */ new Set())};outputFormat:${isJsonMediaType(mediaType) ? "'json'" : "'text'"};status:${status}}`;
115
146
  });
116
147
  });
117
148
  }
@@ -156,12 +187,12 @@ function makeParameterSchema(parameter) {
156
187
  }
157
188
  return parameter.schema ?? {};
158
189
  }
159
- function makeSchemaTypeString(schema, components, visited) {
190
+ function makeSchemaTypeString(schema, aliases, visited) {
160
191
  if (!schema) return "unknown";
161
- if (schema.$ref) return visited.has(schema.$ref) ? "unknown" : makeRefTypeString(schema.$ref, components, /* @__PURE__ */ new Set([...visited, schema.$ref]));
162
- if (schema.oneOf && schema.oneOf.length > 0) return schema.oneOf.map((s) => makeSchemaTypeString(s, components, visited)).join("|");
163
- if (schema.anyOf && schema.anyOf.length > 0) return schema.anyOf.map((s) => makeSchemaTypeString(s, components, visited)).join("|");
164
- if (schema.allOf && schema.allOf.length > 0) return makeAllOfTypeString(schema.allOf, components, visited);
192
+ if (schema.$ref) return makeRefTypeString(schema.$ref, aliases);
193
+ if (schema.oneOf && schema.oneOf.length > 0) return schema.oneOf.map((s) => makeSchemaTypeString(s, aliases, visited)).join("|");
194
+ if (schema.anyOf && schema.anyOf.length > 0) return schema.anyOf.map((s) => makeSchemaTypeString(s, aliases, visited)).join("|");
195
+ if (schema.allOf && schema.allOf.length > 0) return makeAllOfTypeString(schema.allOf, aliases, visited);
165
196
  const isBigintLiteral = (value) => typeof value === "number" && Number.isInteger(value) && (Array.isArray(schema.type) ? schema.type.includes("integer") : schema.type === "integer") && (schema.format === "int64" || schema.format === "uint64" || schema.format === "bigint");
166
197
  if (schema.enum && schema.enum.length > 0) return schema.enum.map((v) => typeof v === "string" ? `'${v.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'` : isBigintLiteral(v) ? `${v}n` : String(v)).join("|");
167
198
  if (schema.const !== void 0) {
@@ -172,27 +203,32 @@ function makeSchemaTypeString(schema, components, visited) {
172
203
  }
173
204
  const types = makeNormalizedTypes(schema);
174
205
  const isNullable = schema.nullable === true || types.includes("null");
175
- const baseType = makeBaseTypeString(schema, types.filter((t) => t !== "null"), components, visited);
206
+ const baseType = makeBaseTypeString(schema, types.filter((t) => t !== "null"), aliases, visited);
176
207
  return isNullable ? `(${baseType}|null)` : baseType;
177
208
  }
178
209
  function makeNormalizedTypes(schema) {
179
210
  return schema.type ? Array.isArray(schema.type) ? schema.type : [schema.type] : ["object"];
180
211
  }
181
- function makeBaseTypeString(schema, types, components, visited) {
182
- return types.length > 1 ? types.map((t) => makeSingleTypeString(schema, t, components, visited)).join("|") : makeSingleTypeString(schema, types[0] ?? "object", components, visited);
212
+ function makeBaseTypeString(schema, types, aliases, visited) {
213
+ return types.length > 1 ? types.map((t) => makeSingleTypeString(schema, t, aliases, visited)).join("|") : makeSingleTypeString(schema, types[0] ?? "object", aliases, visited);
183
214
  }
184
215
  const PRIMITIVE_TYPE_MAP = {
185
216
  boolean: "boolean",
186
217
  null: "null"
187
218
  };
188
- function makeSingleTypeString(schema, type, components, visited) {
219
+ function makeSingleTypeString(schema, type, aliases, visited) {
189
220
  if (type === "string") return schema.format === "binary" ? "File" : "string";
190
221
  if (type === "number" || type === "integer") return schema.format === "int64" || schema.format === "uint64" || schema.format === "bigint" ? "bigint" : "number";
191
- if (type === "array") return makeArrayTypeString(schema, components, visited);
192
- if (type === "object") return makeObjectTypeString(schema, components, visited);
222
+ if (type === "array") return makeArrayTypeString(schema, aliases, visited);
223
+ if (type === "object") return makeObjectTypeString(schema, aliases, visited);
193
224
  return PRIMITIVE_TYPE_MAP[type] ?? "unknown";
194
225
  }
195
- function makeRefTypeString(ref, components, visited) {
226
+ /**
227
+ * A `$ref` into `components.schemas` is the name of the alias that stands for the
228
+ * schema; any other reference, or one to a schema that is not there, is `unknown`.
229
+ */
230
+ function makeRefTypeString(ref, aliases) {
231
+ const { components } = aliases;
196
232
  if (!components) return "unknown";
197
233
  const parts = ref.split("/");
198
234
  const componentType = parts[2];
@@ -200,13 +236,13 @@ function makeRefTypeString(ref, components, visited) {
200
236
  if (!refName) return "unknown";
201
237
  if (componentType === "schemas" && components.schemas) {
202
238
  const schema = components.schemas[refName];
203
- return schema ? makeSchemaTypeString(schema, components, visited) : "unknown";
239
+ return schema ? aliasOf(refName, schema, aliases) : "unknown";
204
240
  }
205
241
  return "unknown";
206
242
  }
207
- function makeAllOfTypeString(allOf, components, visited) {
243
+ function makeAllOfTypeString(allOf, aliases, visited) {
208
244
  const mergedProps = allOf.reduce((acc, subSchema) => {
209
- const newProps = makePropertyMap(subSchema, components, visited);
245
+ const newProps = makePropertyMap(subSchema, aliases, visited);
210
246
  const result = new Map(acc);
211
247
  for (const [key, value] of newProps) {
212
248
  const existing = result.get(key);
@@ -223,15 +259,15 @@ function makeAllOfTypeString(allOf, components, visited) {
223
259
  return required ? `${safeKey}:${type}` : `${safeKey}?:${type}|undefined`;
224
260
  }).join(";")}}`;
225
261
  }
226
- function makePropertyMap(schema, components, visited) {
262
+ function makePropertyMap(schema, aliases, visited) {
227
263
  if (schema.$ref && visited.has(schema.$ref)) return /* @__PURE__ */ new Map();
228
264
  const nextVisited = schema.$ref ? /* @__PURE__ */ new Set([...visited, schema.$ref]) : visited;
229
- const resolved = makeResolvedSchema(schema, components);
230
- const fromAllOf = new Map(resolved.allOf && resolved.allOf.length > 0 ? resolved.allOf.flatMap((subSchema) => [...makePropertyMap(subSchema, components, nextVisited).entries()]) : []);
265
+ const resolved = makeResolvedSchema(schema, aliases.components);
266
+ const fromAllOf = new Map(resolved.allOf && resolved.allOf.length > 0 ? resolved.allOf.flatMap((subSchema) => [...makePropertyMap(subSchema, aliases, nextVisited).entries()]) : []);
231
267
  if (!resolved.properties) return fromAllOf;
232
268
  const requiredSet = new Set(Array.isArray(resolved.required) ? resolved.required : []);
233
269
  const currentProps = new Map(Object.entries(resolved.properties).map(([key, propSchema]) => {
234
- const propType = makeSchemaTypeString(propSchema, components, nextVisited);
270
+ const propType = makeSchemaTypeString(propSchema, aliases, nextVisited);
235
271
  const existing = fromAllOf.get(key);
236
272
  return [key, {
237
273
  type: propType,
@@ -240,26 +276,26 @@ function makePropertyMap(schema, components, visited) {
240
276
  }));
241
277
  return new Map([...fromAllOf, ...currentProps]);
242
278
  }
243
- function makeArrayTypeString(schema, components, visited) {
279
+ function makeArrayTypeString(schema, aliases, visited) {
244
280
  if (!schema.items) return "unknown[]";
245
281
  const items = schema.items;
246
282
  if (typeof items === "boolean") return items ? "unknown[]" : "[]";
247
- if (isSchemaArray(items)) return items.length > 1 ? `[${items.map((item) => makeSchemaTypeString(item, components, visited)).join(",")}]` : items[0] ? makeWrappedArrayType(makeSchemaTypeString(items[0], components, visited)) : "unknown[]";
248
- return makeWrappedArrayType(makeSchemaTypeString(items, components, visited));
283
+ if (isSchemaArray(items)) return items.length > 1 ? `[${items.map((item) => makeSchemaTypeString(item, aliases, visited)).join(",")}]` : items[0] ? makeWrappedArrayType(makeSchemaTypeString(items[0], aliases, visited)) : "unknown[]";
284
+ return makeWrappedArrayType(makeSchemaTypeString(items, aliases, visited));
249
285
  }
250
286
  function makeWrappedArrayType(typeStr) {
251
287
  return typeStr.includes("|") ? `(${typeStr})[]` : `${typeStr}[]`;
252
288
  }
253
- function makeObjectTypeString(schema, components, visited) {
289
+ function makeObjectTypeString(schema, aliases, visited) {
254
290
  const { properties, additionalProperties, required } = schema;
255
291
  if (!properties || Object.keys(properties).length === 0) {
256
292
  if (additionalProperties === false) return "{}";
257
- if (typeof additionalProperties === "object") return `{[x:string]:${makeSchemaTypeString(additionalProperties, components, visited)}}`;
293
+ if (typeof additionalProperties === "object") return `{[x:string]:${makeSchemaTypeString(additionalProperties, aliases, visited)}}`;
258
294
  return "{[x:string]:unknown}";
259
295
  }
260
296
  const requiredSet = new Set(Array.isArray(required) ? required : []);
261
297
  return `{${Object.entries(properties).map(([key, propSchema]) => {
262
- const propType = makeSchemaTypeString(propSchema, components, visited);
298
+ const propType = makeSchemaTypeString(propSchema, aliases, visited);
263
299
  const safeKey = makeSafeKey(key);
264
300
  return requiredSet.has(key) ? `${safeKey}:${propType}` : `${safeKey}?:${propType}|undefined`;
265
301
  }).join(";")}}`;