Skip to content

Commit

Permalink
Merge branch 'honojs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronware authored Jul 10, 2024
2 parents dc7f154 + 72d591a commit a9e43bb
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 172 deletions.
6 changes: 6 additions & 0 deletions packages/swagger-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @hono/swagger-ui

## 0.4.0

### Minor Changes

- [#618](https://github.com/honojs/middleware/pull/618) [`47be5c695662406c220346a741857872115ac0ae`](https://github.com/honojs/middleware/commit/47be5c695662406c220346a741857872115ac0ae) Thanks [@naporin0624](https://github.com/naporin0624)! - Add Full Configuration Parameters and Update Dependencies for Swagger UI

## 0.3.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/swagger-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hono/swagger-ui",
"version": "0.3.0",
"version": "0.4.0",
"description": "A middleware for using SwaggerUI in Hono",
"type": "module",
"main": "dist/index.cjs",
Expand Down Expand Up @@ -41,7 +41,7 @@
"hono": "*"
},
"devDependencies": {
"@types/swagger-ui-dist": "^3.30.3",
"@types/swagger-ui-dist": "^3.30.5",
"hono": "^3.11.7",
"publint": "^0.2.2",
"tsup": "^7.2.0",
Expand Down
61 changes: 60 additions & 1 deletion packages/swagger-ui/src/swagger/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,60 @@ export type DistSwaggerUIOptions = {
layout?: SwaggerConfigs['layout']
docExpansion?: SwaggerConfigs['docExpansion']
maxDisplayedTags?: SwaggerConfigs['maxDisplayedTags']
/**
* accepts function as a string.
*
* @example (a, b) => a.path.localeCompare(b.path)
*/
operationsSorter?: string
/**
* accepts function as a string.
*
* @example (req) => req
*/
requestInterceptor?: string
/**
* accepts function as a string.
*
* @example (res) => res
*/
responseInterceptor?: string
persistAuthorization?: boolean
defaultModelsExpandDepth?: number
defaultModelExpandDepth?: number
defaultModelRendering?: "example" | "model" | undefined
defaultModelRendering?: 'example' | 'model' | undefined
displayRequestDuration?: boolean
filter?: boolean | string
showExtensions?: boolean
showCommonExtensions?: boolean
queryConfigEnabled?: boolean
displayOperationId?: boolean
/**
* accepts function as a string.
* swagger-ui accepts alpha in the tagsSorter, but this middleware does not support it.
*
* @example (a, b) => a.name.localeCompare(b.name)
*/
tagsSorter?: string
/**
* accepts function as a string.
* @example () => { console.log('Swagger UI Loaded'); }
*/
onComplete?: string
syntaxHighlight?: boolean | { activated: boolean; theme: string[] }
tryItOutEnabled?: boolean
requestSnippetsEnabled?: boolean
requestSnippets?: object
oauth2RedirectUrl?: string
showMutabledRequest?: boolean
request?: {
curlOptions?: string[]
}
supportedSubmitMethods?: string[]
validatorUrl?: string
withCredentials?: boolean
modelPropertyMacro?: string
parameterMacro?: string
} & RequireOne<{
url?: SwaggerConfigs['url']
urls?: SwaggerConfigs['urls']
Expand Down Expand Up @@ -59,6 +102,22 @@ const RENDER_TYPE_MAP = {
filter: RENDER_TYPE.RAW,
showExtensions: RENDER_TYPE.RAW,
showCommonExtensions: RENDER_TYPE.RAW,
queryConfigEnabled: RENDER_TYPE.RAW,
displayOperationId: RENDER_TYPE.RAW,
tagsSorter: RENDER_TYPE.RAW,
onComplete: RENDER_TYPE.RAW,
syntaxHighlight: RENDER_TYPE.JSON_STRING,
tryItOutEnabled: RENDER_TYPE.RAW,
requestSnippetsEnabled: RENDER_TYPE.RAW,
requestSnippets: RENDER_TYPE.JSON_STRING,
oauth2RedirectUrl: RENDER_TYPE.STRING,
showMutabledRequest: RENDER_TYPE.RAW,
request: RENDER_TYPE.JSON_STRING,
supportedSubmitMethods: RENDER_TYPE.JSON_STRING,
validatorUrl: RENDER_TYPE.STRING,
withCredentials: RENDER_TYPE.RAW,
modelPropertyMacro: RENDER_TYPE.RAW,
parameterMacro: RENDER_TYPE.RAW,
} as const satisfies Record<
keyof DistSwaggerUIOptions,
(typeof RENDER_TYPE)[keyof typeof RENDER_TYPE]
Expand Down
Loading

0 comments on commit a9e43bb

Please sign in to comment.