fix(swagger-ui): support `persistAuthorization` and boolean option (#265)
* feat: `persistAuthorization` Co-authored-by: Sor4chi <80559385+sor4chi@users.noreply.github.com> * test: `persistAuthorization` * chore: changeset Co-authored-by: Sor4chi <80559385+sor4chi@users.noreply.github.com> --------- Co-authored-by: Sor4chi <80559385+sor4chi@users.noreply.github.com>pull/266/head
parent
a43558b2d6
commit
2e697077bf
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/swagger-ui': minor
|
||||
---
|
||||
|
||||
Added support for `persistAuthorization`.
|
|
@ -14,6 +14,7 @@ export type DistSwaggerUIOptions = {
|
|||
operationsSorter?: string
|
||||
requestInterceptor?: string
|
||||
responseInterceptor?: string
|
||||
persistAuthorization?: boolean
|
||||
}
|
||||
|
||||
const RENDER_TYPE = {
|
||||
|
@ -37,6 +38,7 @@ const RENDER_TYPE_MAP = {
|
|||
operationsSorter: RENDER_TYPE.RAW,
|
||||
requestInterceptor: RENDER_TYPE.RAW,
|
||||
responseInterceptor: RENDER_TYPE.RAW,
|
||||
persistAuthorization: RENDER_TYPE.RAW,
|
||||
} as const satisfies Record<
|
||||
keyof DistSwaggerUIOptions,
|
||||
(typeof RENDER_TYPE)[keyof typeof RENDER_TYPE]
|
||||
|
|
|
@ -124,4 +124,12 @@ describe('SwaggerUIOption Rendering', () => {
|
|||
})
|
||||
).toEqual('responseInterceptor: (res) => res')
|
||||
})
|
||||
|
||||
it('renders correctly with persistAuthorization', () => {
|
||||
expect(
|
||||
renderSwaggerUIOptions({
|
||||
persistAuthorization: true,
|
||||
})
|
||||
).toEqual('persistAuthorization: true')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue