How to use the swagger-ui-dist.SwaggerUIBundle.presets function in swagger-ui-dist

To help you get started, we’ve selected a few swagger-ui-dist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vanilla / vanilla / plugins / swagger-ui / src / scripts / mountSwagger.ts View on Github external
export function mountSwagger() {
    SwaggerUIBundle({
        deepLinking: true,
        dom_id: "#swagger-ui",
        // layout: "DashboardLayout",
        plugins: [SwaggerUIBundle.plugins.DownloadUrl],
        presets: [SwaggerUIBundle.presets.apis],
        requestInterceptor: (request: Request) => {
            request.headers["x-transient-key"] = getMeta("TransientKey");
            return request;
        },
        url: formatUrl("/api/v2/open-api/v3" + window.location.search),
        validatorUrl: null,
    });
}
github gravitee-io / gravitee-management-webui / src / components / documentation / page-swagger.component.ts View on Github external
const plugins = [];
      if (!this.tryItEnabled()) {
        plugins.push(DisableTryItOutPlugin);
      }

      let contentAsJson = {};
      try {
        contentAsJson = JSON.parse(this.page.content);
      } catch (e) {
        contentAsJson = jsyaml.safeLoad(this.page.content);
      }

      let cfg = {
        dom_id: '#swagger-container',
        presets: [
          SwaggerUIBundle.presets.apis,
        ],
        layout: 'BaseLayout',
        plugins: plugins,
        requestInterceptor: (req) => {
          if (req.loadSpec) {
            req.credentials = 'include';
          }
          return req;
        },
        spec: contentAsJson,
      };

      if (!_.isNil(this.page.configuration)) {
        if (this.page.configuration.showURL === "true") {
          cfg["url"] = this.url;
          cfg["spec"] = undefined;

swagger-ui-dist

[![NPM version](https://badge.fury.io/js/swagger-ui-dist.svg)](http://badge.fury.io/js/swagger-ui-dist)

Apache-2.0
Latest version published 14 days ago

Package Health Score

89 / 100
Full package analysis

Similar packages