Skip to content

Commit

Permalink
feat: add optional swaggerCdnUrl for KoaSwaggerUiOptions (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
scofield5658 authored Jun 20, 2022
1 parent fe58493 commit 6c20c66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{title}}</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/{{swaggerVersion}}/swagger-ui.min.css">
<link rel="stylesheet" href="{{swaggerCdnUrl}}/{{swaggerVersion}}/swagger-ui.min.css">
<link rel="icon" type="image/png" href="{{favicon}}" />
<style>
html
Expand Down Expand Up @@ -70,8 +70,8 @@

<div id="swagger-ui"></div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/{{swaggerVersion}}/swagger-ui-bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/{{swaggerVersion}}/swagger-ui-standalone-preset.js"></script>
<script src="{{swaggerCdnUrl}}/{{swaggerVersion}}/swagger-ui-bundle.js"></script>
<script src="{{swaggerCdnUrl}}/{{swaggerVersion}}/swagger-ui-standalone-preset.js"></script>
<script>
function HideTopbarPlugin() {
// this plugin overrides the Topbar component to return nothing
Expand Down
2 changes: 2 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface KoaSwaggerUiOptions {
oauthOptions: boolean | any;
swaggerOptions: SwaggerOptions;
swaggerVersion: string;
swaggerCdnUrl?: string;
routePrefix: string | false;
specPrefix: string;
exposeSpec: boolean;
Expand All @@ -56,6 +57,7 @@ const defaultOptions: KoaSwaggerUiOptions = {
routePrefix: '/docs',
specPrefix: '/docs/spec',
swaggerVersion: '',
swaggerCdnUrl: 'https://cdnjs.cloudflare.com/ajax/libs/swagger-ui',
exposeSpec: false,
hideTopbar: false,
favicon: '/favicon.png',
Expand Down

0 comments on commit 6c20c66

Please sign in to comment.