Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix for base path "/" #92

Merged
merged 2 commits into from
Jul 11, 2014
Merged

Fix for base path "/" #92

merged 2 commits into from
Jul 11, 2014

Conversation

rutchkiwi
Copy link

This fixes a problem I had with with the relative base path "/".
My swagger setup is the following:
http://localhost:8080/core/api-docs/ <- hosts the "main" api doc:

{
  "apiVersion" : "v2",
  "swaggerVersion" : "1.2",
  "apis" : [ {
    "path" : "/api/2.0/report.{format}",
    "description" : "Get reports"
  } ]
}

http://localhost:8080/core/api-docs/api/2.0/report.json <- hosts the actual api doc (for this example it's on the same server but actually it is be hosted elsewhere)

{
  "apiVersion" : "2.0",
  "swaggerVersion" : "1.2",
  "basePath" : "/",
  "resourcePath" : "/api/2.0/report",
  "apis" : [ {
    "path" : "/api/2.0/report/{id}",
    "operations" : [ {
      "method" : "GET",
      "summary" : "Fetch report data",
            ...
  } ]
}

Now, what I'd expect when i try out the "Fetch report data" endpoint, is for the URL to be the base path of the server the api documentation is on + the resource path.
What actually happens (before this pull request) is that I get a request for
http://localhost:8080/core/api-docs/api/2.0/report/, clearly not what i want!
With this fix, the url is
http://localhost:8080/api/2.0/report/ as expected.

Hope you can understand this, I have to admit the different types of paths confuses me a bit but I'm pretty sure this is the way its supposed to work! :)

@rutchkiwi
Copy link
Author

Oh, and I think (not sure though) that this solves issue #84

@gdw2
Copy link

gdw2 commented May 27, 2014

I'm having the same problem @rutchkiwi describes and his PR fixes it for me.

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.

3 participants