hono-takibi 0.9.25 → 0.9.26
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/index.js +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/core/schema.js +6 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -83,7 +83,7 @@ export async function honoTakibi() {
|
|
|
83
83
|
return { ok: false, error: configResult.error };
|
|
84
84
|
}
|
|
85
85
|
const c = configResult.value;
|
|
86
|
-
const takibiResult = c['zod-openapi']
|
|
86
|
+
const takibiResult = c['zod-openapi']?.output
|
|
87
87
|
? await takibi(c.input, c['zod-openapi']?.output, c['zod-openapi']?.exportSchema ?? false, c['zod-openapi']?.exportType ?? false, false, // template
|
|
88
88
|
false)
|
|
89
89
|
: undefined;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type Config = {
|
|
2
2
|
readonly input: `${string}.yaml` | `${string}.json` | `${string}.tsp`;
|
|
3
3
|
readonly 'zod-openapi'?: {
|
|
4
|
-
readonly output
|
|
4
|
+
readonly output?: `${string}.ts`;
|
|
5
5
|
readonly exportType?: boolean;
|
|
6
6
|
readonly exportSchema?: boolean;
|
|
7
7
|
readonly schema?: {
|
package/dist/core/schema.js
CHANGED
|
@@ -26,14 +26,10 @@ export async function schema(input, output, exportType, split) {
|
|
|
26
26
|
if (!schemas) {
|
|
27
27
|
return { ok: false, error: 'No schemas found' };
|
|
28
28
|
}
|
|
29
|
-
const orderedSchemas = resolveSchemasDependencies(schemas);
|
|
30
|
-
if (orderedSchemas.length === 0) {
|
|
31
|
-
return { ok: true, value: 'No schemas found' };
|
|
32
|
-
}
|
|
33
29
|
// split
|
|
34
30
|
if (split) {
|
|
35
31
|
const outDir = output.replace(/\.ts$/, '');
|
|
36
|
-
for (const schemaName of
|
|
32
|
+
for (const schemaName of Object.keys(schemas)) {
|
|
37
33
|
const schema = schemas[schemaName];
|
|
38
34
|
const z = zodToOpenAPI(schema);
|
|
39
35
|
const zs = zodToOpenAPISchema(schemaName, z, true, exportType);
|
|
@@ -58,7 +54,7 @@ export async function schema(input, output, exportType, split) {
|
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
// index.ts
|
|
61
|
-
const indexBody = `${
|
|
57
|
+
const indexBody = `${Object.keys(schemas)
|
|
62
58
|
.map((n) => `export * from './${lowerFirst(n)}'`)
|
|
63
59
|
.join('\n')}\n`;
|
|
64
60
|
const indexFmt = await fmt(indexBody);
|
|
@@ -78,6 +74,10 @@ export async function schema(input, output, exportType, split) {
|
|
|
78
74
|
value: `Generated schema code written to ${outDir}/*.ts (index.ts included)`,
|
|
79
75
|
};
|
|
80
76
|
}
|
|
77
|
+
const orderedSchemas = resolveSchemasDependencies(schemas);
|
|
78
|
+
if (orderedSchemas.length === 0) {
|
|
79
|
+
return { ok: true, value: 'No schemas found' };
|
|
80
|
+
}
|
|
81
81
|
const schemaDefinitions = orderedSchemas
|
|
82
82
|
.map((schemaName) => {
|
|
83
83
|
const schema = schemas[schemaName];
|