Closed DGuidi closed 7 years ago
~~Right now, it's set in the bootstrapper, as seen in the demo: https://github.com/yahehe/Nancy.Swagger/blob/master/samples/Nancy.Swagger.Demo/Bootstrapper.cs#L15~~
(We should probably add something to allow it to be over-written, in case people want to document different versions of a route)
This should be handled automatically? I have a service with different versions for endpoints and I see the version picked up without additional setup
I have a service with different versions for endpoints and I see the version picked up without additional setup
This looks different to me: endpoinds (correct me if I'm wrong) are configured when boostrapping service, so you have some modules used only when your request matches certains constans. I've made similar things with Nancy+Owin, like:
app.MapWhen(ctx => ctx.Request.Path.StartsWithSegments(new PathString("api")),
so your module "v1/test/get" is actually "api/v1/test/get"... this is fine, and actually swaggermodule too listen to "api/api-docs".
ModulePath looks different to me: is used when creating a module - used in constructor in my sample - and appears in nancy route but not in swagger metadata route.
@yahehe You're right. Disregard my earlier statement.
Nancy.Swagger just grabs the route from Nancy.Routing, I believe. https://github.com/yahehe/Nancy.Swagger/blob/master/src/Nancy.Swagger/Services/DefaultSwaggerMetadataProvider.cs#L35
I could look into whether we could find that data, but that might be difficult. Thought I guess we could also add a way to override the automatically generated paths. But as we said before, we're not actively developing for the 1.4.3 stable branch. So I would recommend updating if possible. Otherwise, we would need to make sure to add whatever we change to both branches.
If you're talking about adding a basePath then what Josh said is correct. If you're talking about swagger picking up the inherited routes from parent modules then that already happens in 1.4.3 (apparently my service runs 1.4.3). If you have complex routing logic that should still be captured normally
If you're talking about swagger picking up the inherited routes from parent modules
nope, I talk about what @jnallard said, he point exactly where I see the "problem", metadata provider build routes from Nancy.RouteDescriptor, that doesn't contain ModulePath information.
but as we said before, we're not actively developing for the 1.4.3 stable branch
yep, maybe if you fix master branch, I can try to fix 1.4.3 one
sorry guys, I made a mistake. all is fine, I'm simply dumb and I've missed a check in my code. sorry, again, for the time loss.
A NancyModule can be initialized with a modulePath like
so "test/get" and "test/post" requests are actually "v1/test/get" and "v1/test/post".
I've digged into RouteDescriber and RouteBuilder but I've missed how to specify this. I am missing something?