Skip to content

Commit

Permalink
fix(zod-openapi): infer OpenAPIObjectConfig (#656)
Browse files Browse the repository at this point in the history
* fix(zod-openapi): infer OpenAPIObjectConfig

* minor -> patch
  • Loading branch information
adjsky authored Jul 21, 2024
1 parent 795d4af commit a04ab70
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/unlucky-cheetahs-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---

fix(zod-openapi): infer OpenAPIObjectConfig
5 changes: 4 additions & 1 deletion packages/zod-openapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
OpenApiGeneratorV31,
extendZodWithOpenApi,
} from '@asteasolutions/zod-to-openapi'
import type { OpenAPIObjectConfig } from '@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator'
import { zValidator } from '@hono/zod-validator'
import { Hono } from 'hono'
import type {
Expand Down Expand Up @@ -252,6 +251,10 @@ export type RouteHook<
RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>
>

type OpenAPIObjectConfig = Parameters<
InstanceType<typeof OpenApiGeneratorV3>['generateDocument']
>[0]

export type OpenAPIObjectConfigure<E extends Env, P extends string> =
| OpenAPIObjectConfig
| ((context: Context<E, P>) => OpenAPIObjectConfig)
Expand Down

0 comments on commit a04ab70

Please sign in to comment.