swagger-api / swagger-js

Javascript library to connect to swagger-enabled APIs via browser or nodejs
http://swagger.io
Apache License 2.0
2.62k stars 758 forks source link

basePath not taken into account for v1 spec (resource listing) #346

Closed sberryman closed 9 years ago

sberryman commented 9 years ago

SwaggerSpecConverter.prototype.convert() is not taking into account the basePath for a resourceListing.

in /lib/client.js (https://github.com/swagger-api/swagger-js/blob/master/lib/client.js#L182-L183) you are passing in self.url which I'm sure is fine for almost everyone but not for hapi-swagger's output.

I did a simple test of setting the docLocation by adding the following AFTER line 34: https://github.com/swagger-api/swagger-js/blob/master/lib/spec-converter.js#L34

// basePath
if (obj.basePath) {
  this.setDocumentationLocation(obj.basePath);
}

Once this was added, everything worked like a charm.

fehguy commented 9 years ago

hmm could you send a PR and we can test?

sberryman commented 9 years ago

done