-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2840 from lucas-gregoire/feat/allow-to-disable-sw…
…agger-ui feat: allow to disable Swagger UI
- Loading branch information
Showing
4 changed files
with
248 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,107 @@ | ||
import { SwaggerUiOptions } from './swagger-ui-options.interface'; | ||
import { SwaggerDocumentOptions } from './swagger-document-options.interface'; | ||
import { OpenAPIObject } from './open-api-spec.interface'; | ||
|
||
export interface SwaggerCustomOptions { | ||
/** | ||
* If `true`, Swagger resources paths will be prefixed by the global prefix set through `setGlobalPrefix()`. | ||
* Default: `false`. | ||
* @see https://docs.nestjs.com/faq/global-prefix | ||
*/ | ||
useGlobalPrefix?: boolean; | ||
|
||
/** | ||
* If `false`, only API definitions (JSON and YAML) will be served (on `/{path}-json` and `/{path}-yaml`). | ||
* This is particularly useful if you are already hosting a Swagger UI somewhere else and just want to serve API definitions. | ||
* Default: `true`. | ||
*/ | ||
swaggerUiEnabled?: boolean; | ||
|
||
/** | ||
* Url point the API definition to load in Swagger UI. | ||
*/ | ||
swaggerUrl?: string; | ||
|
||
/** | ||
* Path of the JSON API definition to serve. | ||
* Default: `{{path}}-json`. | ||
*/ | ||
jsonDocumentUrl?: string; | ||
|
||
/** | ||
* Path of the YAML API definition to serve. | ||
* Default: `{{path}}-json`. | ||
*/ | ||
yamlDocumentUrl?: string; | ||
|
||
/** | ||
* Hook allowing to alter the OpenAPI document before being served. | ||
* It's called after the document is generated and before it is served as JSON & YAML. | ||
*/ | ||
patchDocumentOnRequest?: <TRequest = any, TResponse = any>( | ||
req: TRequest, | ||
res: TResponse, | ||
document: OpenAPIObject | ||
) => OpenAPIObject; | ||
|
||
/** | ||
* If `true`, the selector of OpenAPI definitions is displayed in the Swagger UI interface. | ||
* Default: `false`. | ||
*/ | ||
explorer?: boolean; | ||
|
||
/** | ||
* Additional Swagger UI options | ||
*/ | ||
swaggerOptions?: SwaggerUiOptions; | ||
|
||
/** | ||
* Custom CSS styles to inject in Swagger UI page. | ||
*/ | ||
customCss?: string; | ||
|
||
/** | ||
* URL(s) of a custom CSS stylesheet to load in Swagger UI page. | ||
*/ | ||
customCssUrl?: string | string[]; | ||
|
||
/** | ||
* URL(s) of custom JavaScript files to load in Swagger UI page. | ||
*/ | ||
customJs?: string | string[]; | ||
|
||
/** | ||
* Custom JavaScript scripts to load in Swagger UI page. | ||
*/ | ||
customJsStr?: string | string[]; | ||
|
||
/** | ||
* Custom favicon for Swagger UI page. | ||
*/ | ||
customfavIcon?: string; | ||
customSwaggerUiPath?: string; | ||
swaggerUrl?: string; | ||
|
||
/** | ||
* Custom title for Swagger UI page. | ||
*/ | ||
customSiteTitle?: string; | ||
|
||
/** | ||
* File system path (ex: ./node_modules/swagger-ui-dist) containing static Swagger UI assets. | ||
*/ | ||
customSwaggerUiPath?: string; | ||
|
||
/** | ||
* @deprecated This property has no effect. | ||
*/ | ||
validatorUrl?: string; | ||
|
||
/** | ||
* @deprecated This property has no effect. | ||
*/ | ||
url?: string; | ||
|
||
/** | ||
* @deprecated This property has no effect. | ||
*/ | ||
urls?: Record<'url' | 'name', string>[]; | ||
jsonDocumentUrl?: string; | ||
yamlDocumentUrl?: string; | ||
patchDocumentOnRequest?: <TRequest = any, TResponse = any> (req: TRequest, res: TResponse, document: OpenAPIObject) => OpenAPIObject; | ||
|
||
} |
Oops, something went wrong.