yahehe / Nancy.Swagger

Nancy plugin for generated API documentation in Swagger format.
MIT License
133 stars 60 forks source link

No BasePath in Swagger causes Swagger-UI Incompatibility #147

Closed lesthawk closed 6 years ago

lesthawk commented 6 years ago

Expected Behavior

Path to subdirectory url should be included in the Swagger.

Actual Behavior

It isn't.

Steps to Reproduce the Problem

  1. load the swagger page, no basePath value

The Issue's effect

As there's no basepath, Swagger-ui is unable to redirect the method to the correct path when it is not at the root url. e.g. If the service is deployed to http://bob.com/Jane/ then a method DoSomething should be accessible in Swagger UI as http://bob.com/Jane/DoSomething However because the basepath is not being included by Nancy Swagger, the Swagger Ui generates this as: http://bob.com/DoSomething

The alternative is to generate the swagger ui based on the entire deployed path not assuming the url is always deployed at root.

jnallard commented 6 years ago

Yeah, this is probably something that was overlooked. I'll look into this tomorrow, if I get the chance.

Feel free to submit a PR yourself, as it should be pretty easy if you just add it to the SwaggerMetadataProvider.SetInfo function (and to the Info object).

Edit: I was mistaken - the basePath is not part of the info object.