hono-openapi 1.0.6 → 1.0.7
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/index.cjs +7 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -14
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -252,7 +252,6 @@ async function generateSpecs(hono, options = DEFAULT_OPTIONS, c) {
|
|
|
252
252
|
}
|
|
253
253
|
async function generatePaths(hono, ctx) {
|
|
254
254
|
const paths = {};
|
|
255
|
-
const promises = [];
|
|
256
255
|
for (const route of hono.routes) {
|
|
257
256
|
const middlewareHandler = route.handler[uniqueSymbol];
|
|
258
257
|
if (!middlewareHandler) {
|
|
@@ -274,20 +273,14 @@ async function generatePaths(hono, ctx) {
|
|
|
274
273
|
}
|
|
275
274
|
}
|
|
276
275
|
const defaultOptionsForThisMethod = ctx.options.defaultOptions?.[routeMethod];
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
paths
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
)
|
|
288
|
-
);
|
|
276
|
+
const { schema: routeSpecs, components = {} } = await getSpec(middlewareHandler, defaultOptionsForThisMethod);
|
|
277
|
+
ctx.components = mergeComponentsObjects(ctx.components, components);
|
|
278
|
+
registerSchemaPath({
|
|
279
|
+
route,
|
|
280
|
+
specs: routeSpecs,
|
|
281
|
+
paths
|
|
282
|
+
});
|
|
289
283
|
}
|
|
290
|
-
await Promise.all(promises);
|
|
291
284
|
return paths;
|
|
292
285
|
}
|
|
293
286
|
function getHiddenValue(options) {
|
package/dist/index.d.cts
CHANGED
|
@@ -191,7 +191,7 @@ type GenerateSpecOptions = {
|
|
|
191
191
|
defaultOptions: Partial<Record<AllowedMethods | "ALL", DescribeRouteOptions>>;
|
|
192
192
|
};
|
|
193
193
|
type OperationId = string | ((route: RouterRoute) => string);
|
|
194
|
-
type DescribeRouteOptions = Omit<OpenAPIV3_1.OperationObject, "responses" | "
|
|
194
|
+
type DescribeRouteOptions = Omit<OpenAPIV3_1.OperationObject, "responses" | "operationId"> & {
|
|
195
195
|
operationId?: OperationId;
|
|
196
196
|
/**
|
|
197
197
|
* Pass `true` to hide route from OpenAPI/swagger document
|
package/dist/index.d.ts
CHANGED
|
@@ -191,7 +191,7 @@ type GenerateSpecOptions = {
|
|
|
191
191
|
defaultOptions: Partial<Record<AllowedMethods | "ALL", DescribeRouteOptions>>;
|
|
192
192
|
};
|
|
193
193
|
type OperationId = string | ((route: RouterRoute) => string);
|
|
194
|
-
type DescribeRouteOptions = Omit<OpenAPIV3_1.OperationObject, "responses" | "
|
|
194
|
+
type DescribeRouteOptions = Omit<OpenAPIV3_1.OperationObject, "responses" | "operationId"> & {
|
|
195
195
|
operationId?: OperationId;
|
|
196
196
|
/**
|
|
197
197
|
* Pass `true` to hide route from OpenAPI/swagger document
|
package/dist/index.js
CHANGED
|
@@ -250,7 +250,6 @@ async function generateSpecs(hono, options = DEFAULT_OPTIONS, c) {
|
|
|
250
250
|
}
|
|
251
251
|
async function generatePaths(hono, ctx) {
|
|
252
252
|
const paths = {};
|
|
253
|
-
const promises = [];
|
|
254
253
|
for (const route of hono.routes) {
|
|
255
254
|
const middlewareHandler = route.handler[uniqueSymbol];
|
|
256
255
|
if (!middlewareHandler) {
|
|
@@ -272,20 +271,14 @@ async function generatePaths(hono, ctx) {
|
|
|
272
271
|
}
|
|
273
272
|
}
|
|
274
273
|
const defaultOptionsForThisMethod = ctx.options.defaultOptions?.[routeMethod];
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
paths
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
)
|
|
286
|
-
);
|
|
274
|
+
const { schema: routeSpecs, components = {} } = await getSpec(middlewareHandler, defaultOptionsForThisMethod);
|
|
275
|
+
ctx.components = mergeComponentsObjects(ctx.components, components);
|
|
276
|
+
registerSchemaPath({
|
|
277
|
+
route,
|
|
278
|
+
specs: routeSpecs,
|
|
279
|
+
paths
|
|
280
|
+
});
|
|
287
281
|
}
|
|
288
|
-
await Promise.all(promises);
|
|
289
282
|
return paths;
|
|
290
283
|
}
|
|
291
284
|
function getHiddenValue(options) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono-openapi",
|
|
3
3
|
"description": "OpenAPI schema generator for Hono",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@hono/standard-validator": "^0.1.2",
|
|
46
46
|
"@standard-community/standard-json": "^0.3.1",
|
|
47
|
-
"@standard-community/standard-openapi": "^0.2.
|
|
47
|
+
"@standard-community/standard-openapi": "^0.2.4",
|
|
48
48
|
"@types/json-schema": "^7.0.15",
|
|
49
49
|
"hono": "^4.8.3",
|
|
50
50
|
"openapi-types": "^12.1.3"
|