@nestjs/swagger#SwaggerCustomOptions TypeScript Examples

The following examples show how to use @nestjs/swagger#SwaggerCustomOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: config.service.ts    From aqualink-app with MIT License 8 votes vote down vote up
// eslint-disable-next-line class-methods-use-this
  public getSwaggerConfig() {
    const config = new DocumentBuilder()
      .setTitle('Aqualink API documentation')
      .setDescription('The Aqualink public API documentation')
      .addServer(this.API_URL)
      .addBearerAuth()
      .build();

    const documentOptions: SwaggerDocumentOptions = {
      extraModels: [
        UpdateSiteWithApplicationDto,
        UpdateSiteApplicationDto,
        CreateSiteDto,
        CreateSiteApplicationDto,
        Site,
        TimeSeriesPoint,
      ],
    };

    // Disable 'try it out' option as it will only add extra workload to the server
    // Reference: https://github.com/swagger-api/swagger-ui/issues/3725
    const customOptions: SwaggerCustomOptions = {
      swaggerOptions: {
        plugins: {
          statePlugins: {
            spec: { wrapSelectors: { allowTryItOutFor: () => () => false } },
          },
        },
      },
    };

    return { config, documentOptions, customOptions };
  }
Example #2
Source File: index.ts    From edu-server with MIT License 5 votes vote down vote up
customOptions: SwaggerCustomOptions = {
  swaggerOptions: {
    persistAuthorization: true,
  },
  customCss: '.swagger-ui .topbar { display: none }',
  customSiteTitle: 'Edu Server API Docs',
  customfavIcon: 'https://codeforcause.org/favicon.ico',
}