hono-takibi 0.23.0 → 0.24.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 +4 -4
- package/dist/core/docs/index.d.ts +1 -1
- package/dist/core/docs/index.js +1 -1
- package/dist/core/hooks/index.d.ts +2 -2
- package/dist/core/hooks/index.js +1 -1
- package/dist/core/rpc/index.d.ts +2 -2
- package/dist/core/rpc/index.js +2 -2
- package/dist/core/type/index.d.ts +1 -1
- package/dist/core/type/index.js +1 -1
- package/dist/{core-BhMCMrQ6.js → core-Bhi7NjFK.js} +5 -5
- package/dist/{docs-C5t1NRQ8.js → docs-DTHnPNsq.js} +1 -8
- package/dist/generator/zod-openapi-hono/openapi/index.d.ts +1 -1
- package/dist/generator/zod-openapi-hono/openapi/index.js +1 -1
- package/dist/{hooks-CR7angVC.js → hooks-BRODO70o.js} +2 -2
- package/dist/{index-tsPqeV6H.d.ts → index-B3ze4n_I.d.ts} +2 -2
- package/dist/{index-3BQ2KpP9.d.ts → index-BtPuSeOg.d.ts} +1 -1
- package/dist/{openapi-KOHVzQbz.js → openapi-CRWQo78t.js} +13 -14
- package/dist/{rpc-Bgtv3nGI.js → rpc-CoHJtjYX.js} +1 -1
- package/dist/{shared-BxcbHfBt.js → shared-CYeurBoC.js} +3 -3
- package/dist/{utils-vw99OasL.js → utils-Dznx-EnJ.js} +13 -1
- package/dist/vite-plugin/index.js +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
|
5
5
|
import { Console, Effect, FileSystem, Option, Path, Ref, Schema, Stream } from "effect";
|
|
6
6
|
import { Argument, CliError, Command, Flag } from "effect/cli";
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "0.
|
|
8
|
+
var version = "0.24.0";
|
|
9
9
|
var description = "Hono Takibi is a code generator from OpenAPI to @hono/zod-openapi";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/cli/index.ts
|
|
@@ -42,7 +42,7 @@ function runJobs(config) {
|
|
|
42
42
|
const [{ parseOpenAPI }, { FormatOptions }, { cleanSplitOutputs, makeJob, packageRoots }] = yield* Effect.promise(() => Promise.all([
|
|
43
43
|
import("./openapi-DEZCoJlc.js").then((n) => n.t),
|
|
44
44
|
import("./format-CuHABcKC.js").then((n) => n.r),
|
|
45
|
-
import("./shared-
|
|
45
|
+
import("./shared-CYeurBoC.js").then((n) => n.a)
|
|
46
46
|
]));
|
|
47
47
|
const openAPI = yield* parseOpenAPI(config.input);
|
|
48
48
|
const jobs = makeJob(openAPI, config, yield* packageRoots(openAPI, config));
|
|
@@ -80,7 +80,7 @@ function reportJobs(config, previous) {
|
|
|
80
80
|
onFailure: (error) => Console.error(`❌ ${error.message}`),
|
|
81
81
|
onSuccess: (report) => Console.log(report)
|
|
82
82
|
}));
|
|
83
|
-
const { outsideSources } = yield* Effect.promise(() => import("./shared-
|
|
83
|
+
const { outsideSources } = yield* Effect.promise(() => import("./shared-CYeurBoC.js").then((n) => n.a));
|
|
84
84
|
const inputDirectory = path.dirname(path.resolve(config.input));
|
|
85
85
|
return {
|
|
86
86
|
inputDirectory,
|
|
@@ -207,7 +207,7 @@ function generate(args) {
|
|
|
207
207
|
})]
|
|
208
208
|
});
|
|
209
209
|
if (input !== void 0 && output !== void 0) {
|
|
210
|
-
const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-DEZCoJlc.js").then((n) => n.t), import("./core-
|
|
210
|
+
const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-DEZCoJlc.js").then((n) => n.t), import("./core-Bhi7NjFK.js").then((n) => n.t)]));
|
|
211
211
|
return yield* Console.log(yield* takibi(yield* parseOpenAPI(input), output));
|
|
212
212
|
}
|
|
213
213
|
const resolvedConfig = configPath ?? DEFAULT_CONFIG_FILE;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
1
|
+
import { t as OpenAPI } from "../../index-B3ze4n_I.js";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
//#region src/core/docs/index.d.ts
|
|
4
4
|
export declare function docs(openAPI: OpenAPI, output: string, entry?: string, basePath?: string, curl?: boolean, baseUrl?: string): Effect.Effect<string, import("effect/PlatformError").PlatformError, import("effect/FileSystem").FileSystem>;
|
package/dist/core/docs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as docs } from "../../docs-
|
|
1
|
+
export { t as docs } from "../../docs-DTHnPNsq.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
1
|
+
import { t as OpenAPI } from "../../index-B3ze4n_I.js";
|
|
2
2
|
import { n as GenerateError, t as FormatError } from "../../index-D_gf3Xzx.js";
|
|
3
|
-
import { t as Grouping } from "../../index-
|
|
3
|
+
import { t as Grouping } from "../../index-BtPuSeOg.js";
|
|
4
4
|
//#region src/core/hooks/index.d.ts
|
|
5
5
|
declare const HOOK_CONFIGS: {
|
|
6
6
|
readonly swr: {
|
package/dist/core/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as hooks } from "../../hooks-
|
|
1
|
+
export { t as hooks } from "../../hooks-BRODO70o.js";
|
package/dist/core/rpc/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
1
|
+
import { t as OpenAPI } from "../../index-B3ze4n_I.js";
|
|
2
2
|
import { n as GenerateError, t as FormatError } from "../../index-D_gf3Xzx.js";
|
|
3
|
-
import { t as Grouping } from "../../index-
|
|
3
|
+
import { t as Grouping } from "../../index-BtPuSeOg.js";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
//#region src/core/rpc/index.d.ts
|
|
6
6
|
/**
|
package/dist/core/rpc/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as HTTP_METHODS } from "../../constants-Bz8YiPum.js";
|
|
2
2
|
import { i as GenerateError } from "../../format-CuHABcKC.js";
|
|
3
|
-
import {
|
|
4
|
-
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "../../rpc-
|
|
3
|
+
import { B as isOperationLike, J as isRecord, R as isOpenAPIPaths, p as methodPath, u as makeInferRequestType } from "../../utils-Dznx-EnJ.js";
|
|
4
|
+
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "../../rpc-CoHJtjYX.js";
|
|
5
5
|
import { t as emit } from "../../emit-uwlZZeRM.js";
|
|
6
6
|
import { Effect } from "effect";
|
|
7
7
|
import { dirname } from "node:path";
|
package/dist/core/type/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../constants-Bz8YiPum.js";
|
|
2
|
-
import {
|
|
2
|
+
import { $ as isSchemaArray, H as isParameterArray, I as isMediaWithSchema, M as isHttpMethod, R as isOpenAPIPaths, V as isParameter, Z as isRequestBody, _ as statusCodeToNumber, at as isStringRef, d as makeSafeKey, v as toIdentifierPascalCase, z as isOperation } from "../../utils-Dznx-EnJ.js";
|
|
3
3
|
import { t as emit } from "../../emit-uwlZZeRM.js";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import path from "node:path";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { n as COMPONENT_NAMES, p as TEXT_MEDIA_TYPE, r as COMPONENT_REF_PREFIX, s as HTTP_METHODS, u as JSON_MEDIA_TYPE } from "./constants-Bz8YiPum.js";
|
|
3
3
|
import { i as GenerateError, n as fmt } from "./format-CuHABcKC.js";
|
|
4
|
-
import { $ as
|
|
5
|
-
import { A as resolvePathItem, C as makeCallback, D as makeRouteProperties, E as makeRouteEntries, O as makeWebhookEntries, S as zodToOpenAPI, T as makeRef, _ as descendantsWhere, a as responsesCode, b as parseSource, c as headersCode, d as makeExportConst, f as makeImports, g as declarationOf, h as ast, i as schemasCode, k as resolveParameter, l as makeSplitSchemaFile, m as analyzeCircularSchemas, n as routeCode, o as requestBodiesCode, p as makeModuleSpec, r as componentsCode, s as parametersCode, t as zodOpenAPIHono, u as makeConst, v as identifierNames, w as makePathItem, x as textOf, y as parseModule } from "./openapi-
|
|
6
|
-
import { a as entryNames, c as makeGroupClientName, l as operationTags, o as freeName, s as groupNameOf } from "./rpc-
|
|
4
|
+
import { $ as isSchemaArray, E as hasRequestBodyContent, G as isPathItem, I as isMediaWithSchema, K as isPathItemEntry, M as isHttpMethod, O as isCallbacks, P as isInlineMedia, R as isOpenAPIPaths, T as hasNumericConstraint, V as isParameter, Y as isRefObject, _ as statusCodeToNumber, a as ensureSuffix, b as uncapitalizeWord, c as escapeRegexLiteral, d as makeSafeKey, et as isSchemaObject, f as makeStringLiteral, h as renderNamedImport, l as makeBarrel, m as normalizeTypes, nt as isSecurityArray, ot as isValidIdent, p as methodPath, q as isPathItemRef, r as cyclicNodes, rt as isSecurityScheme, v as toIdentifierPascalCase, x as zodToOpenAPISchema, y as uncapitalize, z as isOperation } from "./utils-Dznx-EnJ.js";
|
|
5
|
+
import { A as resolvePathItem, C as makeCallback, D as makeRouteProperties, E as makeRouteEntries, O as makeWebhookEntries, S as zodToOpenAPI, T as makeRef, _ as descendantsWhere, a as responsesCode, b as parseSource, c as headersCode, d as makeExportConst, f as makeImports, g as declarationOf, h as ast, i as schemasCode, k as resolveParameter, l as makeSplitSchemaFile, m as analyzeCircularSchemas, n as routeCode, o as requestBodiesCode, p as makeModuleSpec, r as componentsCode, s as parametersCode, t as zodOpenAPIHono, u as makeConst, v as identifierNames, w as makePathItem, x as textOf, y as parseModule } from "./openapi-CRWQo78t.js";
|
|
6
|
+
import { a as entryNames, c as makeGroupClientName, l as operationTags, o as freeName, s as groupNameOf } from "./rpc-CoHJtjYX.js";
|
|
7
7
|
import { i as readdir, n as mkdir, o as writeFile, r as readFile } from "./file-K6j5IJXi.js";
|
|
8
8
|
import { t as emit } from "./emit-uwlZZeRM.js";
|
|
9
|
-
import { t as hooks } from "./hooks-
|
|
10
|
-
import { t as docs } from "./docs-
|
|
9
|
+
import { t as hooks } from "./hooks-BRODO70o.js";
|
|
10
|
+
import { t as docs } from "./docs-DTHnPNsq.js";
|
|
11
11
|
import { rpc } from "./core/rpc/index.js";
|
|
12
12
|
import { type } from "./core/type/index.js";
|
|
13
13
|
import { Effect } from "effect";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as MULTIPART_MEDIA_TYPE, s as HTTP_METHODS } from "./constants-Bz8YiPum.js";
|
|
2
|
-
import { J as
|
|
2
|
+
import { $ as isSchemaArray, J as isRecord, Y as isRefObject, i as decodePercent, s as escapeHtml } from "./utils-Dznx-EnJ.js";
|
|
3
3
|
import { n as mkdir, o as writeFile } from "./file-K6j5IJXi.js";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import path from "node:path";
|
|
@@ -50,13 +50,6 @@ function toText(value) {
|
|
|
50
50
|
function toSingleLine(value) {
|
|
51
51
|
return value.replaceAll(/\s+/gu, " ").trim();
|
|
52
52
|
}
|
|
53
|
-
function decodePercent(value) {
|
|
54
|
-
try {
|
|
55
|
-
return decodeURIComponent(value);
|
|
56
|
-
} catch {
|
|
57
|
-
return value;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
53
|
/**
|
|
61
54
|
* Decodes one JSON Pointer segment of a URI fragment: percent-encoding first,
|
|
62
55
|
* then `~1` and `~0` (RFC 6901 §6).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../../index-
|
|
1
|
+
import { t as OpenAPI } from "../../../index-B3ze4n_I.js";
|
|
2
2
|
//#region src/generator/zod-openapi-hono/openapi/index.d.ts
|
|
3
3
|
export declare function zodOpenAPIHono(openapi: OpenAPI, options?: {
|
|
4
4
|
readonly readonly?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as zodOpenAPIHono } from "../../../openapi-
|
|
1
|
+
export { t as zodOpenAPIHono } from "../../../openapi-CRWQo78t.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as HTTP_METHODS } from "./constants-Bz8YiPum.js";
|
|
2
2
|
import { i as GenerateError } from "./format-CuHABcKC.js";
|
|
3
|
-
import {
|
|
4
|
-
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "./rpc-
|
|
3
|
+
import { B as isOperationLike, J as isRecord, R as isOpenAPIPaths, S as hasNoContentResponse, n as capitalize, p as methodPath, v as toIdentifierPascalCase } from "./utils-Dznx-EnJ.js";
|
|
4
|
+
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "./rpc-CoHJtjYX.js";
|
|
5
5
|
import { t as emit } from "./emit-uwlZZeRM.js";
|
|
6
6
|
import { Effect } from "effect";
|
|
7
7
|
import path from "node:path";
|
|
@@ -418,8 +418,8 @@ type Schema$1 = {
|
|
|
418
418
|
readonly 'x-coerce'?: boolean;
|
|
419
419
|
/**
|
|
420
420
|
* Opt into `z.stringbool()` for boolean schemas. Use `true` for the default
|
|
421
|
-
* truthy/falsy lists, or pass an object to customize.
|
|
422
|
-
*
|
|
421
|
+
* truthy/falsy lists, or pass an object to customize. Beside it, `x-coerce`
|
|
422
|
+
* has nothing left to read: `z.stringbool()` is what the schema emits.
|
|
423
423
|
* @see https://zod.dev/api?id=stringbool
|
|
424
424
|
*/
|
|
425
425
|
readonly 'x-stringbool'?: true | {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as FORM_MEDIA_TYPES, r as COMPONENT_REF_PREFIX, s as HTTP_METHODS, t as ARROW_FUNCTION_PATTERN } from "./constants-Bz8YiPum.js";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as isSchemaArray, A as isExamplesInput, C as hasNoUserChain, D as hasTypelessConstraint, F as isMedia, G as isPathItem, J as isRecord, K as isPathItemEntry, L as isOffsetTime, N as isInheritedName, O as isCallbacks, Q as isResponses, V as isParameter, W as isParameterRef, X as isRefOnly, Y as isRefObject, a as ensureSuffix, c as escapeRegexLiteral, d as makeSafeKey, et as isSchemaObject, f as makeStringLiteral, g as requestParamsArray, h as renderNamedImport, i as decodePercent, it as isSingleSchema, j as isHeader, k as isDiscriminableBranch, m as normalizeTypes, o as error, ot as isValidIdent, p as methodPath, q as isPathItemRef, r as cyclicNodes, t as baseError, v as toIdentifierPascalCase, w as hasNotProperty, x as zodToOpenAPISchema, y as uncapitalize, z as isOperation } from "./utils-Dznx-EnJ.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { parseSync, visitorKeys } from "oxc-parser";
|
|
5
5
|
//#region src/helper/wire.ts
|
|
@@ -24,7 +24,7 @@ function resolveSchemaRef(ref, schemas) {
|
|
|
24
24
|
if (!ref.startsWith(COMPONENT_REF_PREFIX.schemas)) return void 0;
|
|
25
25
|
const name = ref.slice(COMPONENT_REF_PREFIX.schemas.length);
|
|
26
26
|
if (name.includes("/")) return void 0;
|
|
27
|
-
return schemas?.[
|
|
27
|
+
return schemas?.[decodePercent(name)];
|
|
28
28
|
}
|
|
29
29
|
function primitiveKind(value) {
|
|
30
30
|
if (value === null) return null;
|
|
@@ -545,10 +545,10 @@ function makeRef($ref) {
|
|
|
545
545
|
}
|
|
546
546
|
];
|
|
547
547
|
const propertiesMatch = $ref.match(/^#\/components\/schemas\/([^/]+)\/properties\/(.+)$/u);
|
|
548
|
-
if (propertiesMatch) return `z.lazy(()=>${toIdentifierPascalCase(ensureSuffix(
|
|
548
|
+
if (propertiesMatch) return `z.lazy(()=>${toIdentifierPascalCase(ensureSuffix(decodePercent(propertiesMatch[1]), "Schema"))})`;
|
|
549
549
|
const rawRef = $ref.split("/").at(-1);
|
|
550
550
|
if (!rawRef) return "Schema";
|
|
551
|
-
const decodedRef =
|
|
551
|
+
const decodedRef = decodePercent(rawRef);
|
|
552
552
|
const match = COMPONENT_SUFFIX_MAP.find(({ prefix }) => $ref.startsWith(prefix));
|
|
553
553
|
return toIdentifierPascalCase(ensureSuffix(decodedRef, match?.suffix ?? "Schema"));
|
|
554
554
|
}
|
|
@@ -1938,7 +1938,6 @@ function string(schema, options) {
|
|
|
1938
1938
|
//#endregion
|
|
1939
1939
|
//#region src/generator/zod-to-openapi/index.ts
|
|
1940
1940
|
function zodToOpenAPI(schema, meta, options) {
|
|
1941
|
-
if (schema === void 0) throw new Error("Schema is undefined");
|
|
1942
1941
|
if (schema === true) return wrap("z.any()", {}, meta, options);
|
|
1943
1942
|
if (schema === false) return wrap("z.never()", {}, meta, options);
|
|
1944
1943
|
const nullRead = options?.coerce === true && options.json !== true ? nullReading(schema, options.schemas) : void 0;
|
|
@@ -2075,7 +2074,7 @@ function zodToOpenAPI(schema, meta, options) {
|
|
|
2075
2074
|
const discriminator = schema.discriminator?.propertyName;
|
|
2076
2075
|
const oneOfMessage = schema["x-oneOf-message"] ?? schema["x-error-message"];
|
|
2077
2076
|
const oneOfErrorArg = oneOfMessage ? `,${error(oneOfMessage)}` : "";
|
|
2078
|
-
const branches = schema.oneOf.map((s) => s.$ref === void 0 ? s : isRefOnly(s) && s.$ref.startsWith(COMPONENT_REF_PREFIX.schemas) ? options?.schemas?.[
|
|
2077
|
+
const branches = schema.oneOf.map((s) => s.$ref === void 0 ? s : isRefOnly(s) && s.$ref.startsWith(COMPONENT_REF_PREFIX.schemas) ? options?.schemas?.[decodePercent(s.$ref.slice(COMPONENT_REF_PREFIX.schemas.length))] : void 0);
|
|
2079
2078
|
const literalsPerBranch = branches.map((branch) => {
|
|
2080
2079
|
if (discriminator === void 0 || branch === void 0) return void 0;
|
|
2081
2080
|
if (!isDiscriminableBranch(branch, discriminator)) return void 0;
|
|
@@ -2168,11 +2167,9 @@ function zodToOpenAPI(schema, meta, options) {
|
|
|
2168
2167
|
if (t.includes("boolean")) {
|
|
2169
2168
|
const errorMessage = schema["x-error-message"];
|
|
2170
2169
|
const requiredMessage = schema["x-required-message"];
|
|
2171
|
-
const xCoerce = schema["x-coerce"] === true;
|
|
2172
2170
|
const xStringbool = schema["x-stringbool"];
|
|
2173
|
-
if (xCoerce && xStringbool !== void 0) throw new Error("x-coerce and x-stringbool are mutually exclusive on a boolean schema. Remove one.");
|
|
2174
|
-
const arg = baseError(errorMessage, xCoerce ? void 0 : requiredMessage);
|
|
2175
2171
|
if (xStringbool !== void 0) {
|
|
2172
|
+
const arg = baseError(errorMessage, requiredMessage);
|
|
2176
2173
|
const opts = xStringbool === true ? null : xStringbool;
|
|
2177
2174
|
const optsObj = opts ? {
|
|
2178
2175
|
...opts.truthy !== void 0 ? { truthy: opts.truthy } : {},
|
|
@@ -2183,6 +2180,8 @@ function zodToOpenAPI(schema, meta, options) {
|
|
|
2183
2180
|
const combinedArg = optsStr && arg ? `${optsStr.slice(0, -1)},${arg.slice(1)}` : optsStr || arg;
|
|
2184
2181
|
return done(combinedArg ? `z.stringbool(${combinedArg})` : "z.stringbool()", schema);
|
|
2185
2182
|
}
|
|
2183
|
+
const xCoerce = schema["x-coerce"] === true;
|
|
2184
|
+
const arg = baseError(errorMessage, xCoerce ? void 0 : requiredMessage);
|
|
2186
2185
|
const baseFn = xCoerce ? "z.coerce.boolean" : effective?.coerce ? "z.stringbool" : "z.boolean";
|
|
2187
2186
|
return done(arg ? `${baseFn}(${arg})` : `${baseFn}()`, schema);
|
|
2188
2187
|
}
|
|
@@ -2426,7 +2425,7 @@ function findDiscriminatedBranches(schemas, schemaNames) {
|
|
|
2426
2425
|
if (discriminator === void 0 || schema?.oneOf === void 0) return [];
|
|
2427
2426
|
return schema.oneOf.flatMap((branch) => {
|
|
2428
2427
|
if (!(isRefOnly(branch) && branch.$ref?.startsWith(COMPONENT_REF_PREFIX.schemas))) return [];
|
|
2429
|
-
const name =
|
|
2428
|
+
const name = decodePercent(branch.$ref.slice(COMPONENT_REF_PREFIX.schemas.length));
|
|
2430
2429
|
const target = schemas[name];
|
|
2431
2430
|
return target && isDiscriminableBranch(target, discriminator) ? [name] : [];
|
|
2432
2431
|
});
|
|
@@ -2609,12 +2608,12 @@ function makeTypeString(schema, selfTypeName, cyclicGroup, readonly) {
|
|
|
2609
2608
|
function makeRefTypeString(ref, selfTypeName) {
|
|
2610
2609
|
const propertiesMatch = ref.match(/^#\/components\/schemas\/([^/]+)\/properties\//u);
|
|
2611
2610
|
if (propertiesMatch) {
|
|
2612
|
-
const parentName = toIdentifierPascalCase(
|
|
2611
|
+
const parentName = toIdentifierPascalCase(decodePercent(propertiesMatch[1]));
|
|
2613
2612
|
if (parentName === selfTypeName) return `${parentName}Type`;
|
|
2614
2613
|
return `z.infer<typeof ${parentName}Schema>`;
|
|
2615
2614
|
}
|
|
2616
2615
|
const rawRef = ref.split("/").at(-1) ?? "";
|
|
2617
|
-
const refName = toIdentifierPascalCase(
|
|
2616
|
+
const refName = toIdentifierPascalCase(decodePercent(rawRef));
|
|
2618
2617
|
if (refName === selfTypeName) return `${refName}Type`;
|
|
2619
2618
|
return `z.infer<typeof ${refName}Schema>`;
|
|
2620
2619
|
}
|
|
@@ -2660,12 +2659,12 @@ function makeArrayTypeString(schema, selfTypeName, cyclicGroup, readonly) {
|
|
|
2660
2659
|
if (items.$ref) {
|
|
2661
2660
|
const propertiesMatch = items.$ref.match(/^#\/components\/schemas\/([^/]+)\/properties\//u);
|
|
2662
2661
|
if (propertiesMatch) {
|
|
2663
|
-
const parentName = toIdentifierPascalCase(
|
|
2662
|
+
const parentName = toIdentifierPascalCase(decodePercent(propertiesMatch[1]));
|
|
2664
2663
|
if (parentName === selfTypeName) return `${prefix}${parentName}Type[]`;
|
|
2665
2664
|
return `${prefix}z.infer<typeof ${parentName}Schema>[]`;
|
|
2666
2665
|
}
|
|
2667
2666
|
const rawRef = items.$ref.split("/").at(-1) ?? "";
|
|
2668
|
-
const refName = toIdentifierPascalCase(
|
|
2667
|
+
const refName = toIdentifierPascalCase(decodePercent(rawRef));
|
|
2669
2668
|
if (refName === selfTypeName) return `${prefix}${refName}Type[]`;
|
|
2670
2669
|
return `${prefix}z.infer<typeof ${refName}Schema>[]`;
|
|
2671
2670
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as FORM_MEDIA_TYPES, u as JSON_MEDIA_TYPE } from "./constants-Bz8YiPum.js";
|
|
2
|
-
import {
|
|
2
|
+
import { B as isOperationLike, J as isRecord, U as isParameterObject, Y as isRefObject, ot as isValidIdent, tt as isSchemaProperty } from "./utils-Dznx-EnJ.js";
|
|
3
3
|
//#region src/helper/group.ts
|
|
4
4
|
const RESERVED = /* @__PURE__ */ new Set([
|
|
5
5
|
"arguments",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { n as COMPONENT_NAMES, o as HOOK_LIBRARIES } from "./constants-Bz8YiPum.js";
|
|
3
3
|
import { i as GenerateError } from "./format-CuHABcKC.js";
|
|
4
|
-
import { C as isInsideDirectory, E as makeGeneratedImport, S as appEntryOutput, T as makeAppEntryImport, _ as headers, a as takibi, b as client, c as securitySchemes, d as requestBodies, f as pathItems, g as links, h as mediaTypes, i as defineTemplate, l as schemas, m as components, n as webhooks, o as route, p as parameters, r as template, s as mock, u as responses, v as examples, w as makeAppEntryFile, x as handlerGroupOf, y as callbacks } from "./core-
|
|
4
|
+
import { C as isInsideDirectory, E as makeGeneratedImport, S as appEntryOutput, T as makeAppEntryImport, _ as headers, a as takibi, b as client, c as securitySchemes, d as requestBodies, f as pathItems, g as links, h as mediaTypes, i as defineTemplate, l as schemas, m as components, n as webhooks, o as route, p as parameters, r as template, s as mock, u as responses, v as examples, w as makeAppEntryFile, x as handlerGroupOf, y as callbacks } from "./core-Bhi7NjFK.js";
|
|
5
5
|
import { a as unlink, i as readdir, t as exists } from "./file-K6j5IJXi.js";
|
|
6
|
-
import { t as hooks } from "./hooks-
|
|
7
|
-
import { t as docs } from "./docs-
|
|
6
|
+
import { t as hooks } from "./hooks-BRODO70o.js";
|
|
7
|
+
import { t as docs } from "./docs-DTHnPNsq.js";
|
|
8
8
|
import { rpc } from "./core/rpc/index.js";
|
|
9
9
|
import { type } from "./core/type/index.js";
|
|
10
10
|
import { Effect, FileSystem, Schema } from "effect";
|
|
@@ -424,6 +424,18 @@ function ensureSuffix(text, suffix) {
|
|
|
424
424
|
return `${text}${suffix}`;
|
|
425
425
|
}
|
|
426
426
|
/**
|
|
427
|
+
* Undoes the percent-encoding of one `$ref` segment. A segment that is not valid
|
|
428
|
+
* percent-encoding (`Foo%ZZ`) is kept as it is: no `$ref` makes the generator throw, it
|
|
429
|
+
* just names a component that is not there.
|
|
430
|
+
*/
|
|
431
|
+
function decodePercent(value) {
|
|
432
|
+
try {
|
|
433
|
+
return decodeURIComponent(value);
|
|
434
|
+
} catch {
|
|
435
|
+
return value;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
427
439
|
* Generates a Zod schema constant and optional inferred type alias.
|
|
428
440
|
*
|
|
429
441
|
*
|
|
@@ -546,4 +558,4 @@ function cyclicNodes(deps) {
|
|
|
546
558
|
return result;
|
|
547
559
|
}
|
|
548
560
|
//#endregion
|
|
549
|
-
export {
|
|
561
|
+
export { isSchemaArray as $, isExamplesInput as A, isOperationLike as B, hasNoUserChain as C, hasTypelessConstraint as D, hasRequestBodyContent as E, isMedia as F, isPathItem as G, isParameterArray as H, isMediaWithSchema as I, isRecord as J, isPathItemEntry as K, isOffsetTime as L, isHttpMethod as M, isInheritedName as N, isCallbacks as O, isInlineMedia as P, isResponses as Q, isOpenAPIPaths as R, hasNoContentResponse as S, hasNumericConstraint as T, isParameterObject as U, isParameter as V, isParameterRef as W, isRefOnly as X, isRefObject as Y, isRequestBody as Z, statusCodeToNumber as _, ensureSuffix as a, isStringRef as at, uncapitalizeWord as b, escapeRegexLiteral as c, makeSafeKey as d, isSchemaObject as et, makeStringLiteral as f, requestParamsArray as g, renderNamedImport as h, decodePercent as i, isSingleSchema as it, isHeader as j, isDiscriminableBranch as k, makeBarrel as l, normalizeTypes as m, capitalize as n, isSecurityArray as nt, error as o, isValidIdent as ot, methodPath as p, isPathItemRef as q, cyclicNodes as r, isSecurityScheme as rt, escapeHtml as s, baseError as t, isSchemaProperty as tt, makeInferRequestType as u, toIdentifierPascalCase as v, hasNotProperty as w, zodToOpenAPISchema as x, uncapitalize as y, isOperation as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { l as INPUT_EXTENSIONS } from "../constants-Bz8YiPum.js";
|
|
2
2
|
import { parseConfig } from "../index.js";
|
|
3
3
|
import { t as FormatOptions } from "../format-CuHABcKC.js";
|
|
4
|
-
import {
|
|
5
|
-
import { C as isInsideDirectory, S as appEntryOutput } from "../core-
|
|
4
|
+
import { J as isRecord } from "../utils-Dznx-EnJ.js";
|
|
5
|
+
import { C as isInsideDirectory, S as appEntryOutput } from "../core-Bhi7NjFK.js";
|
|
6
6
|
import { n as parseOpenAPI } from "../openapi-DEZCoJlc.js";
|
|
7
|
-
import { i as packageRoots, n as makeJob, r as outsideSources, t as cleanSplitOutputs } from "../shared-
|
|
7
|
+
import { i as packageRoots, n as makeJob, r as outsideSources, t as cleanSplitOutputs } from "../shared-CYeurBoC.js";
|
|
8
8
|
import { Effect, FileSystem, Option, Result } from "effect";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import crypto from "node:crypto";
|