Skip to content

Commit d56087c

Browse files
committedFeb 15, 2024··
docs: add docs on SwaggerCustomOptions
1 parent 25942eb commit d56087c

File tree

1 file changed

+89
-12
lines changed

1 file changed

+89
-12
lines changed
 

‎lib/interfaces/swagger-custom-options.interface.ts

+89-12
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,106 @@ import { SwaggerUiOptions } from './swagger-ui-options.interface';
22
import { OpenAPIObject } from './open-api-spec.interface';
33

44
export interface SwaggerCustomOptions {
5+
/**
6+
* If `true`, Swagger resources paths will be prefixed by the global prefix set through `setGlobalPrefix()`.
7+
* Default: `false`.
8+
* @see https://docs.nestjs.com/faq/global-prefix
9+
*/
510
useGlobalPrefix?: boolean;
11+
12+
/**
13+
* If `false`, only API definitions (JSON and YAML) will be served (on `/{path}-json` and `/{path}-yaml`).
14+
* This is particularly useful if you are already hosting a Swagger UI somewhere else and just want to serve API definitions.
15+
* Default: `true`.
16+
*/
617
swaggerUiEnabled?: boolean;
18+
19+
/**
20+
* Url point the API definition to load in Swagger UI.
21+
*/
22+
swaggerUrl?: string;
23+
24+
/**
25+
* Path of the JSON API definition to serve.
26+
* Default: `{{path}}-json`.
27+
*/
28+
jsonDocumentUrl?: string;
29+
30+
/**
31+
* Path of the YAML API definition to serve.
32+
* Default: `{{path}}-json`.
33+
*/
34+
yamlDocumentUrl?: string;
35+
36+
/**
37+
* Hook allowing to alter the OpenAPI document before being served.
38+
* It's called after the document is generated and before it is served as JSON & YAML.
39+
*/
40+
patchDocumentOnRequest?: <TRequest = any, TResponse = any>(
41+
req: TRequest,
42+
res: TResponse,
43+
document: OpenAPIObject
44+
) => OpenAPIObject;
45+
46+
/**
47+
* If `true`, the selector of OpenAPI definitions is displayed in the Swagger UI interface.
48+
* Default: `false`.
49+
*/
750
explorer?: boolean;
51+
52+
/**
53+
* Additional Swagger UI options
54+
*/
855
swaggerOptions?: SwaggerUiOptions;
56+
57+
/**
58+
* Custom CSS styles to inject in Swagger UI page.
59+
*/
960
customCss?: string;
61+
62+
/**
63+
* URL(s) of a custom CSS stylesheet to load in Swagger UI page.
64+
*/
1065
customCssUrl?: string | string[];
66+
67+
/**
68+
* URL(s) of custom JavaScript files to load in Swagger UI page.
69+
*/
1170
customJs?: string | string[];
71+
72+
/**
73+
* Custom JavaScript scripts to load in Swagger UI page.
74+
*/
1275
customJsStr?: string | string[];
76+
77+
/**
78+
* Custom favicon for Swagger UI page.
79+
*/
1380
customfavIcon?: string;
14-
customSwaggerUiPath?: string;
15-
swaggerUrl?: string;
81+
82+
/**
83+
* Custom title for Swagger UI page.
84+
*/
1685
customSiteTitle?: string;
17-
/** @deprecated This property has no effect. */
86+
87+
/**
88+
* File system path (ex: ./node_modules/swagger-ui-dist) containing static Swagger UI assets.
89+
*/
90+
customSwaggerUiPath?: string;
91+
92+
/**
93+
* @deprecated This property has no effect.
94+
*/
1895
validatorUrl?: string;
19-
/** @deprecated This property has no effect. */
96+
97+
/**
98+
* @deprecated This property has no effect.
99+
*/
20100
url?: string;
21-
/** @deprecated This property has no effect. */
101+
102+
/**
103+
* @deprecated This property has no effect.
104+
*/
22105
urls?: Record<'url' | 'name', string>[];
23-
jsonDocumentUrl?: string;
24-
yamlDocumentUrl?: string;
25-
patchDocumentOnRequest?: <TRequest = any, TResponse = any>(
26-
req: TRequest,
27-
res: TResponse,
28-
document: OpenAPIObject
29-
) => OpenAPIObject;
106+
30107
}

0 commit comments

Comments
 (0)
Please sign in to comment.