Skip to content

Conversation

@efuquen
Copy link

@efuquen efuquen commented Sep 10, 2013

Currently when you set the basePath of an api declaration to root ('/') a malformed url will be used (something like '//some/url'), which results in an error when you attempt to use the api.

In older versions of swagger this worked as expected, seems this functionality broke when the shred library started being used as it does some magic with parsing urls etc and results in different behaviors. We found this ability useful as it allows us to post swagger specs many different places with different hostnames & ports (i.e. local vs development vs production versions of the api) without having to change the basePath in the code.

This commit will detect if a url begins with a forward slash in the basePath and update it to point all api calls there.

@efuquen
Copy link
Author

efuquen commented Sep 16, 2013

Ping, any thoughts on this pull request?

@fehguy
Copy link
Contributor

fehguy commented Sep 16, 2013

Hi, this will fail if swagger-js is used in a headless fashion, such as with node.js. Wouldn't the best way to set the URL be in the javascript which configures swagger-ui? Or are you looking outside of swagger-ui, and going directly to the library? See here for what i mean:

https://groups.google.com/forum/#!searchin/swagger-swaggersocket/window.location/swagger-swaggersocket/Bz6lUjdUpOs/dyQ_b6n8AOQJ

@fehguy
Copy link
Contributor

fehguy commented Jul 11, 2014

please take a look at #92

@fehguy fehguy closed this Jul 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants