Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Swagger-UI ignoring explore url #3013

Closed
dpeger opened this issue May 2, 2017 · 2 comments
Closed

Swagger-UI ignoring explore url #3013

dpeger opened this issue May 2, 2017 · 2 comments

Comments

@dpeger
Copy link

dpeger commented May 2, 2017

When entering a custom URL into the explore URL field on http://petstore.swagger.io/? this URL will completely be ignored and swagger-ui will always use http://petstore.swagger.io/v2/swagger.json as API spec source.

One can provide a custom URL by adding the url=<custom-swagger-spec> query parameter (e.g. http://petstore.swagger.io/?url=https://github.com/swagger-api/swagger-ui/files/832086/swagger.yaml.txt) but when pressing Explore, swagger-ui will again user the petstore specs.

  • swagger-ui version
    3.0.8
  • a swagger file reproducing the issue
    not relevant
@JustinPealing
Copy link

I'm having a similar issue (updating the URL and then pressing explore resets the URL back to the petstore). I've done some digging and it looks like the downloadUrl function in plugins\topbar\topbar.jsx needs modifying:

downloadUrl = (e) => {
  this.props.specActions.updateUrl(this.state.url)
  this.props.specActions.download(this.state.url)
  // This line is needed to prevent the form submission from refreshing the page
  e.preventDefault();
}

@shockey
Copy link
Contributor

shockey commented May 4, 2017

Just merged the PR for this - the fix will be released as part of our release tomorrow.

Thanks for the input, everyone!

@shockey shockey closed this as completed May 4, 2017
@lock lock bot locked and limited conversation to collaborators Jul 3, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

4 participants