diff --git a/README.md b/README.md index eb7baa6..2b10515 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ swaggerOptions: { // passed to SwaggerUi() defaultModelRendering: 'schema', showRequestHeaders: false, swaggerVersion: 'x.x.x' // read from package.json, + validatorUrl: null, // disable swagger-ui validator }, routePrefix: '/docs', // route where the view is returned specPrefix: '/docs/spec', // route where the spec is returned diff --git a/lib/index.ts b/lib/index.ts index cc2e81a..6df45c7 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -6,22 +6,23 @@ import { sync as readPkgUpSync } from 'read-pkg-up'; import { Context, Middleware, Next } from 'koa'; export interface SwaggerOptions { - [key: string]: string | boolean | string[] | Record; - dom_id: string; - url: string; - supportedSubmitMethods: string[]; - docExpansion: string; - jsonEditor: boolean; - defaultModelRendering: string; - showRequestHeaders: boolean; - layout: string; - spec: Record; + [key: string]: string | boolean | string[] | Record | null | undefined; + dom_id?: string; + url?: string; + supportedSubmitMethods?: string[]; + docExpansion?: string; + jsonEditor?: boolean; + defaultModelRendering?: string; + showRequestHeaders?: boolean; + layout?: string; + spec?: Record; + validatorUrl?: string | null; } export interface KoaSwaggerUiOptions { title: string; oauthOptions: boolean | any; - swaggerOptions: Partial; + swaggerOptions: SwaggerOptions; swaggerVersion: string; routePrefix: string | false; specPrefix: string; diff --git a/test/example.ts b/test/example.ts index a599886..1d7ccfe 100644 --- a/test/example.ts +++ b/test/example.ts @@ -8,7 +8,10 @@ const router = new KoaRouter(); app.use(koaSwagger({ exposeSpec: true, - swaggerOptions: { spec: {} }, + swaggerOptions: { + spec: {}, + validatorUrl: null, + }, })); export default app;