Skip to content
Snippets Groups Projects
index.js 580 B
Newer Older
  • Learn to ignore specific revisions
  • Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
    window.onload = function() {
      const extract = function(v) {
        return decodeURIComponent(
            v.replace(
              /(?:(?:^|.*;\s*)contextPath\s*\=\s*([^;]*).*$)|^.*$/,
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
              '$1'
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
            )
          );
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
      };
    
      const contextPath = extract(document.cookie);
    
      const ui = SwaggerUIBundle({
        url: `${contextPath}/swagger`,
        dom_id: '#swagger-ui',
        tagsSorter: 'alpha',
        presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
        plugins: [SwaggerUIBundle.plugins.DownloadUrl],
        validatorUrl: null,
        deepLinking: true
      });
    
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
      window.ui = ui;
    };