How to use the swagger-ui-dist.SwaggerUIBundle 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 gravitee-io / gravitee-management-webui / src / components / documentation / page-swagger.component.ts View on Github external
cfg["filter"] =
          _.isNil(this.page.configuration.enableFiltering)
            ? false : this.page.configuration.enableFiltering === "true";
        cfg["showExtensions"] =
          _.isNil(this.page.configuration.showExtensions)
            ? false : this.page.configuration.showExtensions === "true";
        cfg["showCommonExtensions"] =
          _.isNil(this.page.configuration.showCommonExtensions)
            ? false : this.page.configuration.showCommonExtensions === "true";
        cfg["oauth2RedirectUrl"] = window.location.origin + '/swagger-oauth2-redirect.html';
        cfg["maxDisplayedTags"] =
          _.isNaN(Number(this.page.configuration.maxDisplayedTags)) || this.page.configuration.maxDisplayedTags === "-1"
            ? undefined : Number(this.page.configuration.maxDisplayedTags);
      }

      const ui = SwaggerUIBundle(
        _.merge(cfg, {
          onComplete: () => {
            // May be used in a short future, so keeping this part of the code to not forget about it.
            ui.initOAuth({
              clientId: "",
//              appName: "Swagger UI",
              scopeSeparator: " ",
//              additionalQueryStringParams: {some_parm: "val"}
            });
//            ui.preauthorizeApiKey('api_key', 'my_api_key')
          }
        }));
    };
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 xm-online / xm-webapp / src / app / admin / docs / docs.component.ts View on Github external
public updateSwagger(resource: any): void {
        const authToken = this.auth.getToken();
        new SwaggerUIBundle({
            dom_id: '#swaggerHolder',
            supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
            url: window.location.protocol + '//' + window.location.host + resource,
            docExpansion: 'none',
            apisSorter: 'alpha',
            showRequestHeaders: false,
            validatorUrl: null,
            configs: {
                preFetch: (req) => {
                    if (authToken) {
                        req.headers['Authorization'] = 'Bearer ' + authToken;
                    }
                    return req;
                },
            },
        });

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