@povio/openapi-codegen-cli 3.1.0-rc.3 → 3.1.0-rc.4
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/metro.d.mts +4 -2
- package/dist/metro.mjs +3 -1
- package/dist/{openapi-BkC5yZ-W.d.mts → openapi-source.runner-BSIrB6ny.d.mts} +26 -1
- package/dist/openapi-source.runner-wLs5vqw6.mjs +705 -0
- package/dist/sh.mjs +1 -1
- package/dist/tiny.d.mts +3 -20
- package/dist/tiny.mjs +1 -649
- package/dist/vite.d.mts +4 -2
- package/dist/vite.mjs +3 -1
- package/package.json +1 -1
- package/dist/openapi-source.runner-D19XnvMe.mjs +0 -39
package/dist/tiny.mjs
CHANGED
|
@@ -1,651 +1,3 @@
|
|
|
1
|
-
import { i as normalizeWatchFolders, n as getLocalInputPath, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path, { join } from "path";
|
|
4
|
-
import { pathToFileURL } from "url";
|
|
5
|
-
import { access, readdir } from "fs/promises";
|
|
1
|
+
import { $ as namedControllerActionInputDtoSchema, A as generateORPCOpenAPISpec, B as getOperationController, C as collectReachableModelSchemas, D as defineOpenApiSchemas, E as createModelSchemaNameGetter, F as getModuleOpenApiController, G as isContractProcedure, H as getProcedureInputSchemaRole, I as getModuleOpenApiTag, J as isObject, K as isNullSchema, L as getObjectPropertySchema, M as getComponentSchemas, N as getContractProcedureData, O as findComponentEnumNames, P as getDerivedOperationId, Q as modelSchemaNameEntries, R as getOpenApiSchemaName, S as collectOperationTags, T as compactTagName, U as getRobodevModuleRoles, V as getPaginatedItemSchema, W as getStringEnumValues, X as isZodSchema, Y as isProcedureMeta, Z as modelSchemaExportName, _ as collectDbTableModelSchemaExports, _t as visitZodSchema, a as addContractSchema, at as operationKey, b as collectModuleModelSchemaExports, c as applyPaginatedItemSchemas, ct as routeHasPathParameters, d as applyRobodevUserRolesExtension, dt as sharedSchemaExportName, et as namedControllerActionSchema, f as asStringArray, ft as stripNoContentResponseBodies, g as collectDbTableModelSchemaExport, gt as toPascalCase, h as collectContractSchemas, ht as toOpenAPIAclRule, i as normalizeWatchFolders, it as namedOpenApiSchema, j as generateOpenApiFile, k as findEnumNames, l as applyParameterExtensions, lt as schemaComponentRef, m as collectContractSchemaRoots, mt as toOpenAPI30Schema, n as getLocalInputPath, nt as namedOpenApiRequestSchema, o as applyEnumExtensions, ot as procedureSchemaName, p as collectApiModelSchemaExports, pt as toOpenAPI30Document, q as isNullableOnlySchema, r as isTinyOpenApiFakeMode, rt as namedOpenApiResponseSchema, s as applyOperationMeta, st as resolveOpenApiOutputPath, t as createTinyOpenApiSourceRunner, tt as namedOpenApiOutputSchema, u as applyRobodevModuleExtensions, ut as schemaExportName, v as collectExtraSchemas, w as collectSchemaRegistryRoots, x as collectOperationMeta, y as collectModelSchemaExports, z as getOperationAction } from "./openapi-source.runner-wLs5vqw6.mjs";
|
|
6
2
|
|
|
7
|
-
//#region src/tiny/openapi.ts
|
|
8
|
-
async function importRuntimeModule(specifier) {
|
|
9
|
-
return new Function("specifier", "return import(specifier)")(specifier);
|
|
10
|
-
}
|
|
11
|
-
const PAGINATED_OUTPUT_SUFFIX = "PaginateOutput";
|
|
12
|
-
const PAGINATED_RESPONSE_SUFFIX = "PaginateResponse";
|
|
13
|
-
const PAGINATION_RESPONSE_OUTPUT_SUFFIX = "PaginationResponseOutput";
|
|
14
|
-
const PAGINATED_ITEM_SUFFIX = "PaginateItem";
|
|
15
|
-
const PAGINATED_ITEM_OUTPUT_SUFFIX = "PaginateItemOutput";
|
|
16
|
-
const PAGINATION_DTO_SCHEMA_NAME = "PaginationDto";
|
|
17
|
-
const PAGINATION_PROPERTY_NAMES = [
|
|
18
|
-
"page",
|
|
19
|
-
"cursor",
|
|
20
|
-
"nextCursor",
|
|
21
|
-
"limit",
|
|
22
|
-
"totalItems"
|
|
23
|
-
];
|
|
24
|
-
const OPENAPI_31_ONLY_KEYS = new Set([
|
|
25
|
-
"$schema",
|
|
26
|
-
"$id",
|
|
27
|
-
"$vocabulary",
|
|
28
|
-
"$dynamicAnchor",
|
|
29
|
-
"$dynamicRef",
|
|
30
|
-
"$defs",
|
|
31
|
-
"jsonSchemaDialect",
|
|
32
|
-
"unevaluatedItems",
|
|
33
|
-
"unevaluatedProperties",
|
|
34
|
-
"dependentRequired",
|
|
35
|
-
"dependentSchemas",
|
|
36
|
-
"prefixItems",
|
|
37
|
-
"propertyNames",
|
|
38
|
-
"contains",
|
|
39
|
-
"minContains",
|
|
40
|
-
"maxContains",
|
|
41
|
-
"contentEncoding",
|
|
42
|
-
"contentMediaType",
|
|
43
|
-
"contentSchema"
|
|
44
|
-
]);
|
|
45
|
-
const openApiSchemaNames = /* @__PURE__ */ new WeakMap();
|
|
46
|
-
function resolveOpenApiOutputPath({ argv = process.argv, cwd = process.cwd(), defaultOutput, env = process.env }) {
|
|
47
|
-
const outputFlagIndex = argv.indexOf("--output");
|
|
48
|
-
const output = (outputFlagIndex !== -1 ? argv[outputFlagIndex + 1] : void 0) ?? env.TINY_OPENAPI_OUTPUT ?? defaultOutput;
|
|
49
|
-
return path.resolve(cwd, output);
|
|
50
|
-
}
|
|
51
|
-
async function generateOpenApiFile(options) {
|
|
52
|
-
const outputPath = resolveOpenApiOutputPath(options);
|
|
53
|
-
const spec = await options.generateOpenApiSpec();
|
|
54
|
-
const output = `${JSON.stringify(spec, null, 2)}\n`;
|
|
55
|
-
if (fs.existsSync(outputPath) && fs.readFileSync(outputPath, "utf8") === output) return {
|
|
56
|
-
outputPath,
|
|
57
|
-
changed: false
|
|
58
|
-
};
|
|
59
|
-
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
60
|
-
fs.writeFileSync(outputPath, output);
|
|
61
|
-
return {
|
|
62
|
-
outputPath,
|
|
63
|
-
changed: true
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function defineOpenApiSchemas(schemas) {
|
|
67
|
-
return schemas;
|
|
68
|
-
}
|
|
69
|
-
function collectExtraSchemas(modules) {
|
|
70
|
-
return Object.values(modules).reduce((schemas, module) => {
|
|
71
|
-
Object.assign(schemas, module.extraSchemas ?? {});
|
|
72
|
-
return schemas;
|
|
73
|
-
}, {});
|
|
74
|
-
}
|
|
75
|
-
function namedOpenApiSchema(schema, name) {
|
|
76
|
-
openApiSchemaNames.set(schema, name);
|
|
77
|
-
return schema;
|
|
78
|
-
}
|
|
79
|
-
function namedOpenApiRequestSchema(schema, name) {
|
|
80
|
-
return namedOpenApiSchema(schema, `${name}Request`);
|
|
81
|
-
}
|
|
82
|
-
function namedOpenApiResponseSchema(schema, name) {
|
|
83
|
-
return namedOpenApiSchema(schema, `${name}Response`);
|
|
84
|
-
}
|
|
85
|
-
function namedOpenApiOutputSchema(schema, name) {
|
|
86
|
-
return namedOpenApiResponseSchema(schema, name);
|
|
87
|
-
}
|
|
88
|
-
function namedControllerActionSchema(schema, controller, action, suffix) {
|
|
89
|
-
return namedOpenApiSchema(schema, `${controller}Controller${toPascalCase(action)}${suffix}`);
|
|
90
|
-
}
|
|
91
|
-
function namedControllerActionInputDtoSchema(schema, controller, action) {
|
|
92
|
-
return namedControllerActionSchema(schema, controller, action, "Request");
|
|
93
|
-
}
|
|
94
|
-
function getOpenApiSchemaName(schema) {
|
|
95
|
-
return typeof schema === "object" && schema !== null ? openApiSchemaNames.get(schema) : void 0;
|
|
96
|
-
}
|
|
97
|
-
function isObject(value) {
|
|
98
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
99
|
-
}
|
|
100
|
-
function getContractProcedureData(router) {
|
|
101
|
-
if (!isObject(router) || !isObject(router["~orpc"])) return;
|
|
102
|
-
const data = router["~orpc"];
|
|
103
|
-
if (!isObject(data.route)) return;
|
|
104
|
-
return {
|
|
105
|
-
inputSchema: data.inputSchema,
|
|
106
|
-
meta: data.meta,
|
|
107
|
-
outputSchema: data.outputSchema,
|
|
108
|
-
route: {
|
|
109
|
-
inputStructure: typeof data.route.inputStructure === "string" ? data.route.inputStructure : void 0,
|
|
110
|
-
method: typeof data.route.method === "string" ? data.route.method : void 0,
|
|
111
|
-
operationId: typeof data.route.operationId === "string" ? data.route.operationId : void 0,
|
|
112
|
-
path: typeof data.route.path === "string" ? data.route.path : void 0,
|
|
113
|
-
successStatus: typeof data.route.successStatus === "number" ? data.route.successStatus : void 0
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function isContractProcedure(router) {
|
|
118
|
-
return Boolean(getContractProcedureData(router));
|
|
119
|
-
}
|
|
120
|
-
function routerEntries(router) {
|
|
121
|
-
return isObject(router) ? Object.entries(router) : [];
|
|
122
|
-
}
|
|
123
|
-
function asStringArray(value) {
|
|
124
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
|
|
125
|
-
}
|
|
126
|
-
function isNullSchema(value) {
|
|
127
|
-
return isObject(value) && value.type === "null";
|
|
128
|
-
}
|
|
129
|
-
function isNullableOnlySchema(value) {
|
|
130
|
-
return isObject(value) && value.nullable === true && Object.keys(value).every((key) => key === "nullable");
|
|
131
|
-
}
|
|
132
|
-
function toOpenAPI30Schema(value) {
|
|
133
|
-
if (Array.isArray(value)) return value.map(toOpenAPI30Schema);
|
|
134
|
-
if (!isObject(value)) return value;
|
|
135
|
-
const next = {};
|
|
136
|
-
for (const [key, rawValue] of Object.entries(value)) {
|
|
137
|
-
if (OPENAPI_31_ONLY_KEYS.has(key)) continue;
|
|
138
|
-
if (key === "const") {
|
|
139
|
-
next.enum = [rawValue];
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
next[key] = toOpenAPI30Schema(rawValue);
|
|
143
|
-
}
|
|
144
|
-
if (Array.isArray(next.type)) {
|
|
145
|
-
const types = next.type.filter((item) => item !== "null");
|
|
146
|
-
if (types.length !== next.type.length) next.nullable = true;
|
|
147
|
-
if (types.length === 1) {
|
|
148
|
-
const [type] = types;
|
|
149
|
-
next.type = type;
|
|
150
|
-
} else if (types.length > 1) {
|
|
151
|
-
delete next.type;
|
|
152
|
-
next.anyOf = types.map((type) => ({ type }));
|
|
153
|
-
} else delete next.type;
|
|
154
|
-
}
|
|
155
|
-
for (const keyword of ["anyOf", "oneOf"]) {
|
|
156
|
-
const branches = next[keyword];
|
|
157
|
-
if (Array.isArray(branches) && branches.some((item) => isNullSchema(item) || isNullableOnlySchema(item))) {
|
|
158
|
-
const nonNullBranches = branches.filter((item) => !isNullSchema(item) && !isNullableOnlySchema(item));
|
|
159
|
-
next.nullable = true;
|
|
160
|
-
if (nonNullBranches.length === 1 && isObject(nonNullBranches[0])) {
|
|
161
|
-
delete next[keyword];
|
|
162
|
-
Object.assign(next, nonNullBranches[0]);
|
|
163
|
-
next.nullable = true;
|
|
164
|
-
} else next[keyword] = nonNullBranches;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (next.type === "null") {
|
|
168
|
-
delete next.type;
|
|
169
|
-
next.nullable = true;
|
|
170
|
-
}
|
|
171
|
-
if (typeof next.$ref === "string" && next.nullable === true) {
|
|
172
|
-
const { $ref, ...rest } = next;
|
|
173
|
-
return {
|
|
174
|
-
...rest,
|
|
175
|
-
allOf: [{ $ref }]
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
return next;
|
|
179
|
-
}
|
|
180
|
-
function stripNoContentResponseBodies(spec) {
|
|
181
|
-
if (!isObject(spec.paths)) return;
|
|
182
|
-
for (const pathItem of Object.values(spec.paths)) {
|
|
183
|
-
if (!isObject(pathItem)) continue;
|
|
184
|
-
for (const operation of Object.values(pathItem)) {
|
|
185
|
-
if (!isObject(operation) || !isObject(operation.responses)) continue;
|
|
186
|
-
const noContentResponse = operation.responses["204"];
|
|
187
|
-
if (isObject(noContentResponse)) delete noContentResponse.content;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
function isProcedureMeta(meta) {
|
|
192
|
-
return isObject(meta) && typeof meta.bl === "string";
|
|
193
|
-
}
|
|
194
|
-
function operationKey(method, routePath) {
|
|
195
|
-
return `${method.toLowerCase()} ${routePath}`;
|
|
196
|
-
}
|
|
197
|
-
function toPascalCase(value) {
|
|
198
|
-
return value.replace(/(^|[-_\s]+)([a-zA-Z0-9]?)/g, (_, _separator, next) => next.toUpperCase());
|
|
199
|
-
}
|
|
200
|
-
function isZodSchema(value) {
|
|
201
|
-
return isObject(value) && isObject(value["~standard"]) && value["~standard"].vendor === "zod" && isObject(value._zod) && isObject(value._zod.def);
|
|
202
|
-
}
|
|
203
|
-
function schemaExportName(moduleName, exportName, schema, getSchemaName = getOpenApiSchemaName) {
|
|
204
|
-
const explicitName = getSchemaName(schema);
|
|
205
|
-
if (explicitName) return explicitName;
|
|
206
|
-
const schemaName = exportName.replace(/Schema$/, "").replace(/DTO$/u, "");
|
|
207
|
-
const modulePrefix = toPascalCase(moduleName);
|
|
208
|
-
const singularModulePrefix = modulePrefix.endsWith("s") ? modulePrefix.slice(0, -1) : modulePrefix;
|
|
209
|
-
return moduleName === "common" || schemaName.startsWith(modulePrefix) || schemaName.startsWith(singularModulePrefix) ? schemaName : `${modulePrefix}${schemaName}`;
|
|
210
|
-
}
|
|
211
|
-
function modelSchemaExportName(exportName) {
|
|
212
|
-
return exportName.replace(/Schema$/, "");
|
|
213
|
-
}
|
|
214
|
-
function sharedSchemaExportName(exportName) {
|
|
215
|
-
return exportName.replace(/Schema$/, "");
|
|
216
|
-
}
|
|
217
|
-
async function collectModelSchemaExports(options) {
|
|
218
|
-
const apiSchemaGroups = options.apiRoot ? await collectApiModelSchemaExports(options.apiRoot) : [];
|
|
219
|
-
const dbSchemaExports = options.dbTablesRoot ? await collectDbTableModelSchemaExports(options.dbTablesRoot) : [];
|
|
220
|
-
return [...apiSchemaGroups, ...dbSchemaExports];
|
|
221
|
-
}
|
|
222
|
-
async function collectApiModelSchemaExports(apiRoot) {
|
|
223
|
-
const entries = await readdir(apiRoot, { withFileTypes: true });
|
|
224
|
-
return (await Promise.all(entries.filter((item) => item.isDirectory()).sort((a, b) => a.name.localeCompare(b.name)).map((entry) => collectModuleModelSchemaExports(apiRoot, entry.name)))).flat();
|
|
225
|
-
}
|
|
226
|
-
async function collectModuleModelSchemaExports(apiRoot, moduleName) {
|
|
227
|
-
const modelsPath = join(apiRoot, moduleName, `${moduleName}.models.ts`);
|
|
228
|
-
try {
|
|
229
|
-
await access(modelsPath);
|
|
230
|
-
} catch {
|
|
231
|
-
return [];
|
|
232
|
-
}
|
|
233
|
-
const models = await import(
|
|
234
|
-
/* @vite-ignore */
|
|
235
|
-
pathToFileURL(modelsPath).href
|
|
236
|
-
);
|
|
237
|
-
const schemas = [];
|
|
238
|
-
for (const [exportName, schema] of Object.entries(models)) if (exportName.endsWith("Schema") && isZodSchema(schema)) schemas.push({
|
|
239
|
-
moduleName,
|
|
240
|
-
name: modelSchemaExportName(exportName),
|
|
241
|
-
schema
|
|
242
|
-
});
|
|
243
|
-
return schemas;
|
|
244
|
-
}
|
|
245
|
-
async function collectDbTableModelSchemaExports(tablesRoot) {
|
|
246
|
-
const tableEntries = await readdir(tablesRoot, { withFileTypes: true });
|
|
247
|
-
return (await Promise.all(tableEntries.filter((item) => item.isDirectory()).sort((a, b) => a.name.localeCompare(b.name)).map((entry) => collectDbTableModelSchemaExport(tablesRoot, entry.name)))).flat();
|
|
248
|
-
}
|
|
249
|
-
async function collectDbTableModelSchemaExport(tablesRoot, tableName) {
|
|
250
|
-
const schemaPath = join(tablesRoot, tableName, `${tableName}.schema.ts`);
|
|
251
|
-
try {
|
|
252
|
-
await access(schemaPath);
|
|
253
|
-
} catch {
|
|
254
|
-
return [];
|
|
255
|
-
}
|
|
256
|
-
const exports = await import(
|
|
257
|
-
/* @vite-ignore */
|
|
258
|
-
pathToFileURL(schemaPath).href
|
|
259
|
-
);
|
|
260
|
-
const schemas = [];
|
|
261
|
-
for (const [exportName, schema] of Object.entries(exports)) if (exportName.endsWith("TypeSchema") && isZodSchema(schema)) schemas.push({
|
|
262
|
-
moduleName: "db",
|
|
263
|
-
name: sharedSchemaExportName(exportName),
|
|
264
|
-
schema
|
|
265
|
-
});
|
|
266
|
-
return schemas;
|
|
267
|
-
}
|
|
268
|
-
function toOpenAPIAclRule(rule) {
|
|
269
|
-
const [subject, action] = rule.split(":");
|
|
270
|
-
return {
|
|
271
|
-
action,
|
|
272
|
-
subject: toPascalCase(subject)
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
function collectOperationMeta(router, routerPath = [], operationMeta = /* @__PURE__ */ new Map()) {
|
|
276
|
-
const procedure = getContractProcedureData(router);
|
|
277
|
-
if (procedure) {
|
|
278
|
-
const { meta, route } = procedure;
|
|
279
|
-
if (route.method && route.path && isProcedureMeta(meta)) operationMeta.set(operationKey(route.method, route.path), {
|
|
280
|
-
meta,
|
|
281
|
-
path: routerPath,
|
|
282
|
-
routeOperationId: route.operationId
|
|
283
|
-
});
|
|
284
|
-
return operationMeta;
|
|
285
|
-
}
|
|
286
|
-
for (const [name, child] of routerEntries(router)) collectOperationMeta(child, [...routerPath, name], operationMeta);
|
|
287
|
-
return operationMeta;
|
|
288
|
-
}
|
|
289
|
-
function getObjectPropertySchema(schema, property) {
|
|
290
|
-
if (!isZodSchema(schema) || schema._zod.def.type !== "object") return;
|
|
291
|
-
const { _zod: { def: { shape } } } = schema;
|
|
292
|
-
if (!isObject(shape)) return;
|
|
293
|
-
const propertySchema = shape[property];
|
|
294
|
-
return isZodSchema(propertySchema) ? propertySchema : void 0;
|
|
295
|
-
}
|
|
296
|
-
function routeHasPathParameters(routePath) {
|
|
297
|
-
return typeof routePath === "string" && /\{[^}]+\}/u.test(routePath);
|
|
298
|
-
}
|
|
299
|
-
function getProcedureInputSchemaRole(route) {
|
|
300
|
-
if (routeHasPathParameters(route.path)) return "Params";
|
|
301
|
-
return route.method?.toUpperCase() === "GET" ? "Query" : "Request";
|
|
302
|
-
}
|
|
303
|
-
function procedureSchemaName(procedureName, role) {
|
|
304
|
-
if (procedureName.endsWith(role)) return procedureName;
|
|
305
|
-
return `${procedureName}${role}`;
|
|
306
|
-
}
|
|
307
|
-
function addContractSchema(schemas, schema, name, getSchemaName, strategy) {
|
|
308
|
-
if (!schema) return;
|
|
309
|
-
schemas[getSchemaName(schema) ?? name] = {
|
|
310
|
-
schema,
|
|
311
|
-
...strategy ? { strategy } : {}
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
function collectContractSchemas(router, routerPath = [], schemas = {}, getSchemaName = getOpenApiSchemaName) {
|
|
315
|
-
const procedure = getContractProcedureData(router);
|
|
316
|
-
if (procedure) {
|
|
317
|
-
const procedureName = routerPath.map(toPascalCase).join("");
|
|
318
|
-
const { inputSchema, outputSchema, route } = procedure;
|
|
319
|
-
if (inputSchema) if (route.inputStructure === "detailed") {
|
|
320
|
-
addContractSchema(schemas, getObjectPropertySchema(inputSchema, "params"), procedureSchemaName(procedureName, "Params"), getSchemaName);
|
|
321
|
-
addContractSchema(schemas, getObjectPropertySchema(inputSchema, "query"), procedureSchemaName(procedureName, "Query"), getSchemaName);
|
|
322
|
-
addContractSchema(schemas, getObjectPropertySchema(inputSchema, "body") ?? inputSchema, procedureSchemaName(procedureName, "Request"), getSchemaName);
|
|
323
|
-
} else addContractSchema(schemas, inputSchema, procedureSchemaName(procedureName, getProcedureInputSchemaRole(route)), getSchemaName);
|
|
324
|
-
if (outputSchema && route.successStatus !== 204) addContractSchema(schemas, outputSchema, procedureSchemaName(procedureName, "Response"), getSchemaName, "output");
|
|
325
|
-
return schemas;
|
|
326
|
-
}
|
|
327
|
-
for (const [name, child] of routerEntries(router)) collectContractSchemas(child, [...routerPath, name], schemas, getSchemaName);
|
|
328
|
-
return schemas;
|
|
329
|
-
}
|
|
330
|
-
function collectContractSchemaRoots(router, roots = /* @__PURE__ */ new Set()) {
|
|
331
|
-
const procedure = getContractProcedureData(router);
|
|
332
|
-
if (procedure) {
|
|
333
|
-
const { inputSchema, outputSchema, route } = procedure;
|
|
334
|
-
if (inputSchema) roots.add(inputSchema);
|
|
335
|
-
if (outputSchema && route.successStatus !== 204) roots.add(outputSchema);
|
|
336
|
-
return roots;
|
|
337
|
-
}
|
|
338
|
-
for (const [, child] of routerEntries(router)) collectContractSchemaRoots(child, roots);
|
|
339
|
-
return roots;
|
|
340
|
-
}
|
|
341
|
-
function visitZodSchema(schema, visit, seen = /* @__PURE__ */ new Set()) {
|
|
342
|
-
if (seen.has(schema)) return;
|
|
343
|
-
seen.add(schema);
|
|
344
|
-
visit(schema);
|
|
345
|
-
const visitValue = (value) => {
|
|
346
|
-
if (isZodSchema(value)) {
|
|
347
|
-
visitZodSchema(value, visit, seen);
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
if (Array.isArray(value)) {
|
|
351
|
-
value.forEach(visitValue);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
if (isObject(value)) Object.values(value).forEach(visitValue);
|
|
355
|
-
};
|
|
356
|
-
const { def } = schema._zod;
|
|
357
|
-
Object.values(def).forEach(visitValue);
|
|
358
|
-
if (typeof def.getter === "function") {
|
|
359
|
-
const lazyValue = def.getter();
|
|
360
|
-
if (isZodSchema(lazyValue)) visitZodSchema(lazyValue, visit, seen);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function collectSchemaRegistryRoots(registry) {
|
|
364
|
-
return Object.values(registry).reduce((schemas, entry) => {
|
|
365
|
-
if ("schema" in entry && entry.schema) schemas.add(entry.schema);
|
|
366
|
-
return schemas;
|
|
367
|
-
}, /* @__PURE__ */ new Set());
|
|
368
|
-
}
|
|
369
|
-
function modelSchemaNameEntries(modelSchemas) {
|
|
370
|
-
const schemaNameBySchema = /* @__PURE__ */ new Map();
|
|
371
|
-
for (const { name, schema } of modelSchemas) {
|
|
372
|
-
const existingName = schemaNameBySchema.get(schema);
|
|
373
|
-
if (!existingName || name.length < existingName.length) schemaNameBySchema.set(schema, name);
|
|
374
|
-
}
|
|
375
|
-
return schemaNameBySchema;
|
|
376
|
-
}
|
|
377
|
-
function createModelSchemaNameGetter(modelSchemas, getSchemaName = getOpenApiSchemaName) {
|
|
378
|
-
const schemaNameBySchema = modelSchemaNameEntries(modelSchemas);
|
|
379
|
-
return (schema) => (isZodSchema(schema) ? schemaNameBySchema.get(schema) : void 0) ?? getSchemaName(schema);
|
|
380
|
-
}
|
|
381
|
-
async function collectReachableModelSchemas(router, options = {}) {
|
|
382
|
-
const excludedSchemas = options.excludedSchemas ?? /* @__PURE__ */ new Set();
|
|
383
|
-
const modelSchemas = options.modelSchemas ?? await collectModelSchemaExports(options);
|
|
384
|
-
const schemaNameBySchema = modelSchemaNameEntries(modelSchemas);
|
|
385
|
-
const routeRoots = collectContractSchemaRoots(router);
|
|
386
|
-
const reachableSchemas = {};
|
|
387
|
-
for (const { moduleName, name, schema } of modelSchemas) if ((moduleName === "common" || name.endsWith("SortableKey") || name.endsWith("OrderParamEnum")) && !excludedSchemas.has(schema)) reachableSchemas[name] = { schema };
|
|
388
|
-
for (const root of routeRoots) {
|
|
389
|
-
if (!isZodSchema(root)) continue;
|
|
390
|
-
visitZodSchema(root, (schema) => {
|
|
391
|
-
if (routeRoots.has(schema) || excludedSchemas.has(schema)) return;
|
|
392
|
-
const name = schemaNameBySchema.get(schema);
|
|
393
|
-
if (name) reachableSchemas[name] = { schema };
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
return reachableSchemas;
|
|
397
|
-
}
|
|
398
|
-
function compactTagName(value) {
|
|
399
|
-
return value.replace(/[^a-zA-Z0-9]/g, "");
|
|
400
|
-
}
|
|
401
|
-
function getModuleOpenApiController(apiModules, moduleName) {
|
|
402
|
-
const module = apiModules[moduleName];
|
|
403
|
-
return module?.openApiController ?? `${compactTagName(module?.openApiTag ?? toPascalCase(moduleName))}Controller`;
|
|
404
|
-
}
|
|
405
|
-
function getOperationController(apiModules, operationPath) {
|
|
406
|
-
const [moduleName, controllerSegment] = operationPath;
|
|
407
|
-
if (!moduleName) return;
|
|
408
|
-
if (!controllerSegment || operationPath.length === 2) return getModuleOpenApiController(apiModules, moduleName);
|
|
409
|
-
return `${getModuleOpenApiController(apiModules, moduleName).replace(/Controller$/, "")}${toPascalCase(controllerSegment)}Controller`;
|
|
410
|
-
}
|
|
411
|
-
function getOperationAction(operationPath) {
|
|
412
|
-
return operationPath.at(-1);
|
|
413
|
-
}
|
|
414
|
-
function getDerivedOperationId(apiModules, info) {
|
|
415
|
-
const controller = getOperationController(apiModules, info.path);
|
|
416
|
-
const action = getOperationAction(info.path);
|
|
417
|
-
return controller && action ? `${controller}_${action}` : void 0;
|
|
418
|
-
}
|
|
419
|
-
function applyOperationMeta(spec, operationMeta, apiModules) {
|
|
420
|
-
if (!isObject(spec.paths)) return;
|
|
421
|
-
for (const [routePath, pathItem] of Object.entries(spec.paths)) {
|
|
422
|
-
if (!isObject(pathItem)) continue;
|
|
423
|
-
for (const [method, operation] of Object.entries(pathItem)) {
|
|
424
|
-
if (!isObject(operation)) continue;
|
|
425
|
-
const info = operationMeta.get(operationKey(method, routePath));
|
|
426
|
-
if (!info) continue;
|
|
427
|
-
operation.operationId = info.routeOperationId ?? getDerivedOperationId(apiModules, info) ?? operation.operationId;
|
|
428
|
-
const { meta } = info;
|
|
429
|
-
operation["x-bl"] = meta.bl;
|
|
430
|
-
if (meta.acl) {
|
|
431
|
-
operation["x-acl"] = meta.acl.map(toOpenAPIAclRule);
|
|
432
|
-
operation.responses = {
|
|
433
|
-
...isObject(operation.responses) ? operation.responses : {},
|
|
434
|
-
"401": { description: "Unauthorized" },
|
|
435
|
-
"403": { description: "Forbidden" }
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
function findEnumNames(value) {
|
|
442
|
-
if (!isObject(value)) return;
|
|
443
|
-
const enumNames = value["x-enumNames"];
|
|
444
|
-
if (Array.isArray(enumNames) && enumNames.every((item) => typeof item === "string")) return enumNames;
|
|
445
|
-
for (const keyword of [
|
|
446
|
-
"allOf",
|
|
447
|
-
"anyOf",
|
|
448
|
-
"oneOf"
|
|
449
|
-
]) {
|
|
450
|
-
const schemas = value[keyword];
|
|
451
|
-
if (!Array.isArray(schemas)) continue;
|
|
452
|
-
for (const schema of schemas) {
|
|
453
|
-
const nestedEnumNames = findEnumNames(schema);
|
|
454
|
-
if (nestedEnumNames) return nestedEnumNames;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
function getStringEnumValues(schema) {
|
|
459
|
-
const { enum: enumValues } = schema;
|
|
460
|
-
if (!Array.isArray(enumValues) || enumValues.length === 0) return;
|
|
461
|
-
return enumValues.every((item) => typeof item === "string") ? enumValues : void 0;
|
|
462
|
-
}
|
|
463
|
-
function applyEnumExtensions(value) {
|
|
464
|
-
if (Array.isArray(value)) {
|
|
465
|
-
value.forEach(applyEnumExtensions);
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
if (!isObject(value)) return;
|
|
469
|
-
const enumNames = getStringEnumValues(value);
|
|
470
|
-
if (enumNames && !Array.isArray(value["x-enumNames"])) value["x-enumNames"] = enumNames;
|
|
471
|
-
Object.values(value).forEach(applyEnumExtensions);
|
|
472
|
-
}
|
|
473
|
-
function findComponentEnumNames(spec, name) {
|
|
474
|
-
const { components } = spec;
|
|
475
|
-
if (!isObject(components) || !isObject(components.schemas)) return;
|
|
476
|
-
const schema = components.schemas[name];
|
|
477
|
-
if (!isObject(schema)) return;
|
|
478
|
-
return findEnumNames(schema) ?? getStringEnumValues(schema);
|
|
479
|
-
}
|
|
480
|
-
function applyParameterExtensions(spec, realBackendSortableSchemaNames = /* @__PURE__ */ new Map()) {
|
|
481
|
-
if (!isObject(spec.paths)) return;
|
|
482
|
-
for (const pathItem of Object.values(spec.paths)) {
|
|
483
|
-
if (!isObject(pathItem)) continue;
|
|
484
|
-
for (const operation of Object.values(pathItem)) {
|
|
485
|
-
if (!isObject(operation) || !Array.isArray(operation.parameters)) continue;
|
|
486
|
-
const [tag] = Array.isArray(operation.tags) ? operation.tags : [];
|
|
487
|
-
const sortableSchemaName = typeof tag === "string" ? realBackendSortableSchemaNames.get(tag) ?? `${toPascalCase(tag)}SortableKey` : void 0;
|
|
488
|
-
const sortableEnumNames = sortableSchemaName ? findComponentEnumNames(spec, sortableSchemaName) : void 0;
|
|
489
|
-
for (const parameter of operation.parameters) {
|
|
490
|
-
if (!isObject(parameter) || parameter.in !== "query") continue;
|
|
491
|
-
if (parameter.name === "filter" && parameter.required !== true) parameter.required = false;
|
|
492
|
-
const enumNames = findEnumNames(parameter.schema) ?? (parameter.name === "order" ? sortableEnumNames : void 0);
|
|
493
|
-
if (enumNames) parameter["x-enumNames"] = enumNames;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
function getModuleOpenApiTag(apiModules, moduleName) {
|
|
499
|
-
return apiModules[moduleName]?.openApiTag ?? moduleName;
|
|
500
|
-
}
|
|
501
|
-
function applyRobodevModuleExtensions(spec, moduleExtensions, apiModules) {
|
|
502
|
-
if (moduleExtensions.size === 0) return;
|
|
503
|
-
const existingTags = Array.isArray(spec.tags) ? spec.tags.filter(isObject) : [];
|
|
504
|
-
const tagsByName = /* @__PURE__ */ new Map();
|
|
505
|
-
for (const tag of existingTags) if (typeof tag.name === "string") tagsByName.set(tag.name, tag);
|
|
506
|
-
for (const [moduleName, metadata] of moduleExtensions) {
|
|
507
|
-
const tagName = getModuleOpenApiTag(apiModules, moduleName);
|
|
508
|
-
const tag = tagsByName.get(tagName) ?? { name: tagName };
|
|
509
|
-
if (metadata.hidden) tag["x-robodev-hidden"] = true;
|
|
510
|
-
if (metadata.tables.length > 0) tag["x-robodev-owned-tables"] = metadata.tables;
|
|
511
|
-
if (metadata.roles.length > 0) tag["x-robodev-roles"] = metadata.roles;
|
|
512
|
-
tagsByName.set(tagName, tag);
|
|
513
|
-
}
|
|
514
|
-
spec.tags = [...tagsByName.values()];
|
|
515
|
-
}
|
|
516
|
-
function applyRobodevUserRolesExtension(spec, userRoles = []) {
|
|
517
|
-
spec["x-robodev-user-roles"] = userRoles.map((role) => ({
|
|
518
|
-
name: role.name,
|
|
519
|
-
description: role.description,
|
|
520
|
-
...role.isDefault ? { isDefault: true } : {}
|
|
521
|
-
}));
|
|
522
|
-
}
|
|
523
|
-
function collectOperationTags(spec) {
|
|
524
|
-
const tags = /* @__PURE__ */ new Set();
|
|
525
|
-
if (!isObject(spec.paths)) return tags;
|
|
526
|
-
for (const pathItem of Object.values(spec.paths)) {
|
|
527
|
-
if (!isObject(pathItem)) continue;
|
|
528
|
-
for (const operation of Object.values(pathItem)) {
|
|
529
|
-
if (!isObject(operation)) continue;
|
|
530
|
-
asStringArray(operation.tags).forEach((tag) => tags.add(tag));
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
return tags;
|
|
534
|
-
}
|
|
535
|
-
function getRobodevModuleRoles(hidden, explicitRoles, moduleHasOperations, defaultRoles) {
|
|
536
|
-
if (hidden) return [];
|
|
537
|
-
if (explicitRoles) return [...explicitRoles];
|
|
538
|
-
return moduleHasOperations ? [...defaultRoles] : [];
|
|
539
|
-
}
|
|
540
|
-
function schemaComponentRef(name) {
|
|
541
|
-
return { $ref: `#/components/schemas/${name}` };
|
|
542
|
-
}
|
|
543
|
-
function getComponentSchemas(spec) {
|
|
544
|
-
const { components } = spec;
|
|
545
|
-
if (!isObject(components) || !isObject(components.schemas)) return null;
|
|
546
|
-
return components.schemas;
|
|
547
|
-
}
|
|
548
|
-
function getPaginatedItemSchema(schema) {
|
|
549
|
-
const { properties } = schema;
|
|
550
|
-
if (!isObject(properties) || !PAGINATION_PROPERTY_NAMES.every((name) => name in properties)) return null;
|
|
551
|
-
const { items } = properties;
|
|
552
|
-
if (!isObject(items) || items.type !== "array" || !isObject(items.items)) return null;
|
|
553
|
-
return items.items;
|
|
554
|
-
}
|
|
555
|
-
function applyPaginatedItemSchemas(spec) {
|
|
556
|
-
const schemas = getComponentSchemas(spec);
|
|
557
|
-
if (!schemas) return;
|
|
558
|
-
for (const [name, schema] of Object.entries(schemas)) {
|
|
559
|
-
if (!(name.endsWith(PAGINATED_OUTPUT_SUFFIX) || name.endsWith(PAGINATED_RESPONSE_SUFFIX) || name.endsWith(PAGINATION_RESPONSE_OUTPUT_SUFFIX)) || !isObject(schema)) continue;
|
|
560
|
-
const itemSchema = getPaginatedItemSchema(schema);
|
|
561
|
-
if (!itemSchema) continue;
|
|
562
|
-
const itemName = name.endsWith(PAGINATION_RESPONSE_OUTPUT_SUFFIX) ? name.replace(new RegExp(`${PAGINATION_RESPONSE_OUTPUT_SUFFIX}$`), PAGINATED_ITEM_OUTPUT_SUFFIX) : name.replace(new RegExp(`${PAGINATED_OUTPUT_SUFFIX}$`), PAGINATED_ITEM_SUFFIX).replace(new RegExp(`${PAGINATED_RESPONSE_SUFFIX}$`), PAGINATED_ITEM_SUFFIX);
|
|
563
|
-
schemas[itemName] = { allOf: [itemSchema] };
|
|
564
|
-
schemas[name] = { allOf: [schemaComponentRef(PAGINATION_DTO_SCHEMA_NAME), {
|
|
565
|
-
type: "object",
|
|
566
|
-
properties: { items: {
|
|
567
|
-
type: "array",
|
|
568
|
-
items: schemaComponentRef(itemName)
|
|
569
|
-
} },
|
|
570
|
-
required: ["items"]
|
|
571
|
-
}] };
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
function toOpenAPI30Document(spec) {
|
|
575
|
-
const converted = toOpenAPI30Schema(spec);
|
|
576
|
-
converted.openapi = "3.0.3";
|
|
577
|
-
const components = isObject(converted.components) ? converted.components : {};
|
|
578
|
-
components.securitySchemes = {
|
|
579
|
-
...isObject(components.securitySchemes) ? components.securitySchemes : {},
|
|
580
|
-
bearerAuth: {
|
|
581
|
-
type: "http",
|
|
582
|
-
scheme: "bearer"
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
converted.components = components;
|
|
586
|
-
stripNoContentResponseBodies(converted);
|
|
587
|
-
return converted;
|
|
588
|
-
}
|
|
589
|
-
async function generateORPCOpenAPISpec(options) {
|
|
590
|
-
const [{ OpenAPIGenerator }, { ZodToJsonSchemaConverter }] = await Promise.all([importRuntimeModule("@orpc/openapi"), importRuntimeModule("@orpc/zod/zod4")]);
|
|
591
|
-
const generator = new OpenAPIGenerator({ schemaConverters: [new ZodToJsonSchemaConverter()] });
|
|
592
|
-
const explicitSchemaName = options.getOpenApiSchemaName ?? getOpenApiSchemaName;
|
|
593
|
-
const modelSchemas = await collectModelSchemaExports({
|
|
594
|
-
apiRoot: options.apiRoot,
|
|
595
|
-
dbTablesRoot: options.dbTablesRoot
|
|
596
|
-
});
|
|
597
|
-
const getSchemaName = createModelSchemaNameGetter(modelSchemas, explicitSchemaName);
|
|
598
|
-
const operationMeta = collectOperationMeta(options.contract);
|
|
599
|
-
const extraSchemas = collectExtraSchemas(options.apiModules);
|
|
600
|
-
const reachableModelSchemas = await collectReachableModelSchemas(options.contract, {
|
|
601
|
-
apiRoot: options.apiRoot,
|
|
602
|
-
dbTablesRoot: options.dbTablesRoot,
|
|
603
|
-
excludedSchemas: collectSchemaRegistryRoots(extraSchemas),
|
|
604
|
-
getOpenApiSchemaName: getSchemaName,
|
|
605
|
-
modelSchemas
|
|
606
|
-
});
|
|
607
|
-
const commonSchemas = {
|
|
608
|
-
...collectContractSchemas(options.contract, [], {}, getSchemaName),
|
|
609
|
-
...extraSchemas,
|
|
610
|
-
...reachableModelSchemas
|
|
611
|
-
};
|
|
612
|
-
const spec = await generator.generate(options.contract, {
|
|
613
|
-
info: options.info ?? {
|
|
614
|
-
title: "Tiny Template Fake API",
|
|
615
|
-
description: "OpenAPI spec generated from the oRPC fake backend contract.",
|
|
616
|
-
version: "3.0.0"
|
|
617
|
-
},
|
|
618
|
-
servers: options.servers ?? [{
|
|
619
|
-
url: "/",
|
|
620
|
-
description: "Current origin"
|
|
621
|
-
}],
|
|
622
|
-
...Object.keys(commonSchemas).length > 0 ? { commonSchemas } : {}
|
|
623
|
-
});
|
|
624
|
-
const jsonSpec = spec;
|
|
625
|
-
const sortableSchemaNames = options.realBackendSortableSchemaNames instanceof Map ? options.realBackendSortableSchemaNames : new Map(Object.entries(options.realBackendSortableSchemaNames ?? {}));
|
|
626
|
-
applyOperationMeta(jsonSpec, operationMeta, options.apiModules);
|
|
627
|
-
applyEnumExtensions(spec);
|
|
628
|
-
applyParameterExtensions(jsonSpec, sortableSchemaNames);
|
|
629
|
-
applyPaginatedItemSchemas(jsonSpec);
|
|
630
|
-
const userRoles = options.userRoles ?? [];
|
|
631
|
-
const defaultRobodevRoles = userRoles.filter((role) => role.isDefault).map((role) => role.name);
|
|
632
|
-
const operationTags = collectOperationTags(jsonSpec);
|
|
633
|
-
const robodevModuleExtensions = /* @__PURE__ */ new Map();
|
|
634
|
-
for (const [name, module] of Object.entries(options.apiModules)) {
|
|
635
|
-
const tagName = getModuleOpenApiTag(options.apiModules, name);
|
|
636
|
-
const hidden = module.robodevHidden === true;
|
|
637
|
-
const explicitRobodevRoles = Array.isArray(module.robodevRoles) ? [...module.robodevRoles] : null;
|
|
638
|
-
const metadata = {
|
|
639
|
-
hidden,
|
|
640
|
-
tables: Array.isArray(module.robodevOwnedTables) ? [...module.robodevOwnedTables] : [],
|
|
641
|
-
roles: getRobodevModuleRoles(hidden, explicitRobodevRoles, operationTags.has(tagName), defaultRobodevRoles)
|
|
642
|
-
};
|
|
643
|
-
if (metadata.hidden || metadata.tables.length > 0 || metadata.roles.length > 0) robodevModuleExtensions.set(name, metadata);
|
|
644
|
-
}
|
|
645
|
-
applyRobodevModuleExtensions(jsonSpec, robodevModuleExtensions, options.apiModules);
|
|
646
|
-
applyRobodevUserRolesExtension(jsonSpec, userRoles);
|
|
647
|
-
return toOpenAPI30Document(jsonSpec);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
//#endregion
|
|
651
3
|
export { addContractSchema, applyEnumExtensions, applyOperationMeta, applyPaginatedItemSchemas, applyParameterExtensions, applyRobodevModuleExtensions, applyRobodevUserRolesExtension, asStringArray, collectApiModelSchemaExports, collectContractSchemaRoots, collectContractSchemas, collectDbTableModelSchemaExport, collectDbTableModelSchemaExports, collectExtraSchemas, collectModelSchemaExports, collectModuleModelSchemaExports, collectOperationMeta, collectOperationTags, collectReachableModelSchemas, collectSchemaRegistryRoots, compactTagName, createModelSchemaNameGetter, createTinyOpenApiSourceRunner, defineOpenApiSchemas, findComponentEnumNames, findEnumNames, generateORPCOpenAPISpec, generateOpenApiFile, getComponentSchemas, getContractProcedureData, getDerivedOperationId, getModuleOpenApiController, getModuleOpenApiTag, getObjectPropertySchema, getOpenApiSchemaName, getOperationAction, getOperationController, getPaginatedItemSchema, getProcedureInputSchemaRole, getRobodevModuleRoles, getStringEnumValues, getLocalInputPath as getTinyOpenApiLocalInputPath, isContractProcedure, isNullSchema, isNullableOnlySchema, isObject, isProcedureMeta, isTinyOpenApiFakeMode, isZodSchema, modelSchemaExportName, modelSchemaNameEntries, namedControllerActionInputDtoSchema, namedControllerActionSchema, namedOpenApiOutputSchema, namedOpenApiRequestSchema, namedOpenApiResponseSchema, namedOpenApiSchema, normalizeWatchFolders as normalizeTinyOpenApiWatchFolders, operationKey, procedureSchemaName, resolveOpenApiOutputPath, routeHasPathParameters, schemaComponentRef, schemaExportName, sharedSchemaExportName, stripNoContentResponseBodies, toOpenAPI30Document, toOpenAPI30Schema, toOpenAPIAclRule, toPascalCase, visitZodSchema };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as GenerateFileFormatter } from "./options-CE4Koxof.mjs";
|
|
2
2
|
import { t as OpenAPICodegenConfig } from "./config-BU7wVf7U.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-BSIrB6ny.mjs";
|
|
4
4
|
import { Plugin, PluginOption } from "vite";
|
|
5
5
|
|
|
6
6
|
//#region src/plugins/openapi-codegen.runner.d.ts
|
|
@@ -18,7 +18,9 @@ interface TinyOpenApiCodegenViteOptions {
|
|
|
18
18
|
cwd?: string;
|
|
19
19
|
debounceMs?: number;
|
|
20
20
|
env?: NodeJS.ProcessEnv;
|
|
21
|
-
generateOpenApiFile
|
|
21
|
+
generateOpenApiFile?: GenerateOpenApiFile;
|
|
22
|
+
generateOpenApiSpec?: GenerateOpenApiSpec;
|
|
23
|
+
generateOpenApiSpecModule?: string | TinyOpenApiSpecModuleConfig;
|
|
22
24
|
watchFolders: readonly string[];
|
|
23
25
|
}
|
|
24
26
|
declare function tinyOpenApiCodegen(codegenConfig: OpenApiCodegenViteConfig, options: TinyOpenApiCodegenViteOptions): PluginOption[];
|