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
|
return document
|
||||||
}
|
}
|
||||||
|
|
||||||
doc = (path: string, config: OpenAPIObjectConfig) => {
|
doc = <P extends string>(
|
||||||
this.get(path, (c) => {
|
path: P,
|
||||||
|
config: OpenAPIObjectConfig
|
||||||
|
): OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath> => {
|
||||||
|
return this.get(path, (c) => {
|
||||||
const document = this.getOpenAPIDocument(config)
|
const document = this.getOpenAPIDocument(config)
|
||||||
return c.json(document)
|
return c.json(document)
|
||||||
})
|
}) as any
|
||||||
}
|
}
|
||||||
|
|
||||||
doc31 = (path: string, config: OpenAPIObjectConfig) => {
|
doc31 = <P extends string>(
|
||||||
this.get(path, (c) => {
|
path: P,
|
||||||
|
config: OpenAPIObjectConfig
|
||||||
|
): OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath> => {
|
||||||
|
return this.get(path, (c) => {
|
||||||
const document = this.getOpenAPI31Document(config)
|
const document = this.getOpenAPI31Document(config)
|
||||||
return c.json(document)
|
return c.json(document)
|
||||||
})
|
}) as any
|
||||||
}
|
}
|
||||||
|
|
||||||
route<
|
route<
|
||||||
|
|
Loading…
Reference in New Issue