I tried to use the ApiExplorer to generate a documentation for my API. But the routes that I have registered with AttributeRouting isn't detected by the ApiExplorer.
I don't know why but if I add the routing by using the routes.MapHttpRoute(...) method they all appear as they should.
This might be related to #83
I'm not sure. I think it could be because the ApiExplorer search for IHttpRoutes and, correct me if I'm wrong, AttributeRouting uses ordinary routes that don't implement that interface?
I don't recall any IHttpRoute in the source. Will look into this further. Sorry for the delay, been away from the macine for a few weeks.
I think we need to use the same code in AttributeRouting.Web.Http as in AttributeRouting.Web.Http.SelfHost. It looks like you use the HttpRoute there and that class implements the IHttpRoute.
Yes, I think you are correct. Looking into the webstack source and it seems that AR should be building a System.Web.Http.WebHost.Routing.HostedHttpRoute. But this object is internal! So will have to go through the source and see what we can use, if this object is public in the nightly builds, etc....
resolved issue #102 and can use api explorer now #86.
Give the code in master a try if you'd like. I believe this might have been resolved by 2.4.2.
There is a working use case of ApiExplorer in https://github.com/mccalltd/AttributeRouting/blob/master/src/AttributeRouting.Tests.Web/Controllers/ApiExplorerController.cs
I tried to do the same in a ApiController but I couldn't get the explorer to detect my routes.
Edit: Yes, I updated to the 2.4.2 version.
Interesting. I'm still working to resolve the ApiExplorer integration, FYI.
Try 2.4.3. I just pushed to nuget. If it still isn't working for you, you can give me more details about what you are doing and I can try and help. I do have a demo of using ApiExplorer in AttributeRouting.Tests.Web, FYI.
Now it's working! I updated to 2.4.3 version and it worked. Thanks alot, what did you change?
Just changed some underlying bits to tie into the RC version of Web API properly (ie: copied what MS did). But so glad it's working!
Also note that you're going to encounter the problems mentioned in #102. But I am working closely with the ASP.NET team to resolve all the remaining Web API goofiness so AR can be a default package in new web projects.
Hi, running v2.5.3 and .NET 4.5 and I'm still not able to get the ApiExplorer to populate my routes. In all fairness I am not storing the actuall code files in the default controllers folder but I didn't think that would matter. Is there a specific set of instructions or things you have to do to get the ApiExplorer to load the AR routes?
Yea, tried looking into that but even with copying your code in over mine still no joy. It may simply be an issue with the RTM bits versus RC. Either way, I've actually rethought how I want to generate help pages and actually determined I'd rather create a web service that provides a JSON feed of the entire set of services or per controller and then display that on a different application. Separates the API application/service from the marketing and CMS content.
Just following up to see if this was ever investigated. I was able to create a brand new project and everything works as expected. However, my existing project does not but that could be for god knows what reason. I have a sample project for others but it doesn't look like I can attach it here.
No. It fell of the table. Reading over the discussion, and knowing that AR and ApiExplorer have some other issues anyway, I'd like a sample project recreating the issue (could just pop it into a github repo for me to clone). It seems really inconsistent and I have frankly no idea what could be happening at this point or why the ApiExplorer is misbehaving.
Yep, agreed. I can't seem to understand what the difference is either. I have a feeling it has to do with how/when the routes are added to the Routing Table thing.
I'm going to try setting up my base project and add things to match what is currently in place and see when the behavior goes nuts.
If I can get it to do so I'll get a project uploaded for you to take a look at.