Skip to content

Problem with relative path in swagger.api.basepath #114

@vbauer

Description

@vbauer

In old version of swagger-ui (maybe 1.0, 1.1) I can configure my "swagger.api.basepath" parameter like "/rest" but in last version it works only with "http://localhost:8080/rest".

To prevent this behaviour I use some hack in swagger.js (in function SwaggerApi.prototype.build):

          if (_this.basePath.indexOf('/') == 0) {
              var bp = $('#input_baseUrl').val();
              var suffix = '/resources.json';

              if (bp.indexOf(suffix, bp.length - suffix.length) !== -1) {
                  bp = bp.substring(0, bp.length - suffix.length);
              }
              _this.basePath = bp;
          }

So I can use one build of application (war file) on different servers with different ports.

It's very uncomfortable to migrate this dirty hack from one version to another... Can you please add possibility to use relative path in "swagger.api.basepath" (like "/rest") instead of absolute path (like "http://localhost:8080/rest")?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions