@hono/zod-openapi 0.14.5 → 0.14.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.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +12 -2
- package/dist/index.mjs +12 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -132,7 +132,15 @@ declare class OpenAPIHono<E extends Env = Env, S extends Schema = {}, BasePath e
|
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
|
-
} ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>, hook?: Hook<I, E, P,
|
|
135
|
+
} ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>, hook?: Hook<I, E, P, R extends {
|
|
136
|
+
responses: {
|
|
137
|
+
[statusCode: number]: {
|
|
138
|
+
content: {
|
|
139
|
+
[mediaType: string]: ZodMediaTypeObject;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
} ? MaybePromise<RouteConfigToTypedResponse<R>> | undefined : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response> | undefined> | undefined) => OpenAPIHono<E, S & ToSchema<R['method'], MergePath<BasePath, P>, I, RouteConfigToTypedResponse<R>>, BasePath>;
|
|
136
144
|
getOpenAPIDocument: (config: OpenAPIObjectConfig) => openapi3_ts_oas30.OpenAPIObject;
|
|
137
145
|
getOpenAPI31Document: (config: OpenAPIObjectConfig) => openapi3_ts_oas31.OpenAPIObject;
|
|
138
146
|
doc: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath>;
|
package/dist/index.d.ts
CHANGED
|
@@ -132,7 +132,15 @@ declare class OpenAPIHono<E extends Env = Env, S extends Schema = {}, BasePath e
|
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
|
-
} ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>, hook?: Hook<I, E, P,
|
|
135
|
+
} ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>, hook?: Hook<I, E, P, R extends {
|
|
136
|
+
responses: {
|
|
137
|
+
[statusCode: number]: {
|
|
138
|
+
content: {
|
|
139
|
+
[mediaType: string]: ZodMediaTypeObject;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
} ? MaybePromise<RouteConfigToTypedResponse<R>> | undefined : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response> | undefined> | undefined) => OpenAPIHono<E, S & ToSchema<R['method'], MergePath<BasePath, P>, I, RouteConfigToTypedResponse<R>>, BasePath>;
|
|
136
144
|
getOpenAPIDocument: (config: OpenAPIObjectConfig) => openapi3_ts_oas30.OpenAPIObject;
|
|
137
145
|
getOpenAPI31Document: (config: OpenAPIObjectConfig) => openapi3_ts_oas31.OpenAPIObject;
|
|
138
146
|
doc: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath>;
|
package/dist/index.js
CHANGED
|
@@ -121,12 +121,12 @@ var OpenAPIHono = class _OpenAPIHono extends import_hono.Hono {
|
|
|
121
121
|
getOpenAPIDocument = (config) => {
|
|
122
122
|
const generator = new import_zod_to_openapi.OpenApiGeneratorV3(this.openAPIRegistry.definitions);
|
|
123
123
|
const document = generator.generateDocument(config);
|
|
124
|
-
return document;
|
|
124
|
+
return this._basePath ? addBasePathToDocument(document, this._basePath) : document;
|
|
125
125
|
};
|
|
126
126
|
getOpenAPI31Document = (config) => {
|
|
127
127
|
const generator = new import_zod_to_openapi.OpenApiGeneratorV31(this.openAPIRegistry.definitions);
|
|
128
128
|
const document = generator.generateDocument(config);
|
|
129
|
-
return document;
|
|
129
|
+
return this._basePath ? addBasePathToDocument(document, this._basePath) : document;
|
|
130
130
|
};
|
|
131
131
|
doc = (path, configure) => {
|
|
132
132
|
return this.get(path, (c) => {
|
|
@@ -199,6 +199,16 @@ var createRoute = (routeConfig) => {
|
|
|
199
199
|
return Object.defineProperty(route, "getRoutingPath", { enumerable: false });
|
|
200
200
|
};
|
|
201
201
|
(0, import_zod_to_openapi.extendZodWithOpenApi)(import_zod.z);
|
|
202
|
+
function addBasePathToDocument(document, basePath) {
|
|
203
|
+
const updatedPaths = {};
|
|
204
|
+
Object.keys(document.paths).forEach((path) => {
|
|
205
|
+
updatedPaths[(0, import_url.mergePath)(basePath, path)] = document.paths[path];
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
...document,
|
|
209
|
+
paths: updatedPaths
|
|
210
|
+
};
|
|
211
|
+
}
|
|
202
212
|
// Annotate the CommonJS export names for ESM import in node:
|
|
203
213
|
0 && (module.exports = {
|
|
204
214
|
OpenAPIHono,
|
package/dist/index.mjs
CHANGED
|
@@ -100,12 +100,12 @@ var OpenAPIHono = class _OpenAPIHono extends Hono {
|
|
|
100
100
|
getOpenAPIDocument = (config) => {
|
|
101
101
|
const generator = new OpenApiGeneratorV3(this.openAPIRegistry.definitions);
|
|
102
102
|
const document = generator.generateDocument(config);
|
|
103
|
-
return document;
|
|
103
|
+
return this._basePath ? addBasePathToDocument(document, this._basePath) : document;
|
|
104
104
|
};
|
|
105
105
|
getOpenAPI31Document = (config) => {
|
|
106
106
|
const generator = new OpenApiGeneratorV31(this.openAPIRegistry.definitions);
|
|
107
107
|
const document = generator.generateDocument(config);
|
|
108
|
-
return document;
|
|
108
|
+
return this._basePath ? addBasePathToDocument(document, this._basePath) : document;
|
|
109
109
|
};
|
|
110
110
|
doc = (path, configure) => {
|
|
111
111
|
return this.get(path, (c) => {
|
|
@@ -178,6 +178,16 @@ var createRoute = (routeConfig) => {
|
|
|
178
178
|
return Object.defineProperty(route, "getRoutingPath", { enumerable: false });
|
|
179
179
|
};
|
|
180
180
|
extendZodWithOpenApi(z);
|
|
181
|
+
function addBasePathToDocument(document, basePath) {
|
|
182
|
+
const updatedPaths = {};
|
|
183
|
+
Object.keys(document.paths).forEach((path) => {
|
|
184
|
+
updatedPaths[mergePath(basePath, path)] = document.paths[path];
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
...document,
|
|
188
|
+
paths: updatedPaths
|
|
189
|
+
};
|
|
190
|
+
}
|
|
181
191
|
export {
|
|
182
192
|
OpenAPIHono,
|
|
183
193
|
createRoute,
|