feat(zod-openapi): Make it possible to do method chaining even for do… (#260)
* feat(zod-openapi): Make it possible to do method chaining even for doc methods * fix: Fix incorrect generics type specificationpull/263/head
parent
4c5b5be848
commit
ba83a268e0
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/zod-openapi': patch
|
||||
---
|
||||
|
||||
Make it possible to do method chaining even for doc methods
|
|
@ -277,18 +277,24 @@ export class OpenAPIHono<
|
|||
return document
|
||||
}
|
||||
|
||||
doc = (path: string, config: OpenAPIObjectConfig) => {
|
||||
this.get(path, (c) => {
|
||||
doc = <P extends string>(
|
||||
path: P,
|
||||
config: OpenAPIObjectConfig
|
||||
): OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath> => {
|
||||
return this.get(path, (c) => {
|
||||
const document = this.getOpenAPIDocument(config)
|
||||
return c.json(document)
|
||||
})
|
||||
}) as any
|
||||
}
|
||||
|
||||
doc31 = (path: string, config: OpenAPIObjectConfig) => {
|
||||
this.get(path, (c) => {
|
||||
doc31 = <P extends string>(
|
||||
path: P,
|
||||
config: OpenAPIObjectConfig
|
||||
): OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath> => {
|
||||
return this.get(path, (c) => {
|
||||
const document = this.getOpenAPI31Document(config)
|
||||
return c.json(document)
|
||||
})
|
||||
}) as any
|
||||
}
|
||||
|
||||
route<
|
||||
|
|
Loading…
Reference in New Issue