Skip to content

Commit

Permalink
feat: export some types that might be useful for users
Browse files Browse the repository at this point in the history
  • Loading branch information
paolostyle committed Oct 11, 2024
1 parent f77869c commit 5ecd9f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/createOpenApiDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import type { Env, Hono, Schema } from 'hono';
import { z } from 'zod';
import {
createDocument,
type ZodOpenApiObject,
type ZodOpenApiOperationObject,
type ZodOpenApiPathsObject,
type ZodOpenApiResponsesObject,
} from 'zod-openapi';
import { normalizeResponse } from './normalizeResponse';
import { OpenApiSymbol } from './openApi';
import type {
HonoOpenApiDocument,
HonoOpenApiResponses,
Method,
NormalizedRequestSchemas,
Expand All @@ -29,7 +29,7 @@ export function createOpenApiDocument<
P extends string,
>(
router: Hono<E, S, P>,
document: Omit<ZodOpenApiObject, 'openapi'>,
document: HonoOpenApiDocument,
{ addRoute = true, routeName = '/doc' }: Settings = {},
): ReturnType<typeof createDocument> {
const paths: ZodOpenApiPathsObject = {};
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ export {
defineOpenApiOperation,
openApi,
} from './openApi';
export type {
HonoOpenApiDocument,
HonoOpenApiResponseObject,
Operation,
} from './types';
3 changes: 3 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
import type { StatusCode } from 'hono/utils/http-status';
import type { z } from 'zod';
import type {
ZodOpenApiObject,
ZodOpenApiOperationObject,
ZodOpenApiResponseObject,
} from 'zod-openapi';
Expand Down Expand Up @@ -133,3 +134,5 @@ export interface Operation<Req extends RequestSchemas = RequestSchemas>
request?: Req;
responses: HonoOpenApiResponses;
}

export type HonoOpenApiDocument = Omit<ZodOpenApiObject, 'openapi'>;

0 comments on commit 5ecd9f8

Please sign in to comment.