Swaggeratr icon indicating copy to clipboard operation
Swaggeratr copied to clipboard

Update swagger-ui to 2.0.latest

Open makotogitdev opened this issue 11 years ago • 3 comments

It looks like there's a new version of swagger-ui. We should update it.

makotogitdev avatar Jan 09 '14 16:01 makotogitdev

global asax: protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.Add(new ServiceRoute("v1/rest", new WebServiceHostFactory(), typeof(RESTful))); RouteTable.Routes.Add(new ServiceRoute("api-docs", new WebServiceHostFactory(), typeof(Swaggerator.Discoverator))); } issue: when i call .../api-docs, i just get

{"apiVersion":"1.0.0.0","swaggerVersion":"1.2","apis":[{"path":"/v1/rest","description":"A RESTful WCF Service"}]}

although when i walk the code, i see that it eventually calls GetServiceDetails whose string api variable is full of the complete swagger.

Why?

github5775 avatar Apr 30 '15 15:04 github5775

Yes, when you request /api-docs, you're just getting a list of the available apis. The expectation is that you will then request the details of each api separately, for instance by fetching /api-docs/v1/rest.

superstator avatar Apr 30 '15 19:04 superstator

thanks for this great code, and thanks for getting back to me...

yes, i figured that out the hard way by seeing that the GetServiceDetails(string servicePath) takes what's after the Swaggerator virtual service name, i.e. "api-docs" if that was the name of the service route. your note above will help a lot of people that are new to this code.

then...today, i discovered that the FindMethods function actually looks for interfaces:

Type[] interfaces = serviceType.GetInterfaces();

so...that means that legacy wcf services that do not implement a service interface will return no swagger.

so, i was thinking of adding some code that will pull the methods if the interfaces count is 0. what do you think?

github5775 avatar May 01 '15 19:05 github5775