asp.net-mvc-apiexplorer

ASP.Net Web Api - ApiExplorer does not contain any ApiDescriptions

风格不统一 提交于 2019-12-30 05:57:15
问题 I am trying to implement an Options method in a controller of my web service that will return a message containing the valid HTTP methods for the URI endpoint associated with the controller. My Options method looks something like this: public HttpResponseMessage Options() { var resp = new HttpResponseMessage(); resp.Content = new StringContent(""); var apiExplorer = GlobalConfiguration.Configuration.Services .GetApiExplorer(); foreach (ApiDescription api in apiExplorer.ApiDescriptions) { resp

Web Api - Auto generating request samples using ApiExplorer

痞子三分冷 提交于 2019-12-23 11:59:05
问题 Is there a way to make ApiExplorer auto generate request samples? I tried using: config.SetActualResponseType(typeof(SomeType), "ControllerName", "Post"); in HelpPageConfig.cs, but 2 problems came up: it requires me to define specific types for specific controllers and actions and I'm looking for something more generic which will not require adding\changing code if a new controller\type was added. I can only use one type per controller\action, so I can't generate a full request sample for an

Valid routes not discovered by MVC.ApiExplorer

拈花ヽ惹草 提交于 2019-12-21 09:06:08
问题 When using ASP.NET Web API Help Page and the related MVC.ApiExplorer I have valid routes that are accessible via http yet aren't discovered by ApiExplorer. These routes are only found when a general routing rule is used. Usage of a more specific rule (in conjunction with the general one) seems to hide routes from the ApiExplorer. In an example case of three rules two routes relate to a GET and a POST action on a controller method which take no query parameters go MIA. public class

WebAPI Help Page - Documentation for return or parameter model/class properties

假如想象 提交于 2019-12-21 05:24:06
问题 I am using Web API Help Page with Web API 2 (5.0) - both the latest Nuget packages. I would like the help documentation to show the comments of the properties on classes that are parameters or returned in the body of the HttpResponseMessage. For example, I have a controller method like this: public HttpResponseMessage Post([FromBody] MyClassType1 myClass) { // Business logic removed for clarity return Request.CreateResponse(HttpStatusCode.OK, new MyClassType2()); } I would like the XML

ApiExplorer for WebAPI controllers in external assembly

橙三吉。 提交于 2019-12-14 03:20:27
问题 My WebApi controllers are located in an assembly (self-hosted OWIN application or ASP MVC application). Is it possible to use ApiExplorer form another application (that loads an assembly with WebApi controllers dynamically) to generate Web API documentation? 回答1: ApiExplorer uses the GlobalConfiguration to determine the available ApiControllers. When you specify an external assembly you typically do this by replacing the IAssemblyResolver that WebApi is using. This can be done in Application

DotNetCore - is ApiExplorer supported, and how to use it?

巧了我就是萌 提交于 2019-12-06 05:19:17
问题 Does dot net core 1.0 support use of APIExplorer? I'm unable to find any docs on it or how to use it, has anyone used it and can share some insight? 回答1: Thank you for your response Itay, it helped me a bit getting the answer I wanted. To anyone else that needs to use the ApiExplorer, I found a well written post here on StackOverflow. MVC6 - List of all routes Short answer, to get the routes you can have the IApiDescriptionGroupCollectionProvider injected into your controller using

Valid routes not discovered by MVC.ApiExplorer

痴心易碎 提交于 2019-12-04 02:45:05
When using ASP.NET Web API Help Page and the related MVC.ApiExplorer I have valid routes that are accessible via http yet aren't discovered by ApiExplorer. These routes are only found when a general routing rule is used. Usage of a more specific rule (in conjunction with the general one) seems to hide routes from the ApiExplorer. In an example case of three rules two routes relate to a GET and a POST action on a controller method which take no query parameters go MIA. public class SomeControllerController : ApiController { [HttpPost] public HttpResponseMessage Post(PostObject value) { ... }

WebAPI Help Page - Documentation for return or parameter model/class properties

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 17:02:18
I am using Web API Help Page with Web API 2 (5.0) - both the latest Nuget packages. I would like the help documentation to show the comments of the properties on classes that are parameters or returned in the body of the HttpResponseMessage. For example, I have a controller method like this: public HttpResponseMessage Post([FromBody] MyClassType1 myClass) { // Business logic removed for clarity return Request.CreateResponse(HttpStatusCode.OK, new MyClassType2()); } I would like the XML comments that I have on MyClassType1 and MyClassType2 to be displayed on the help page for the above post

ASP.NET Web API Generate all parameters from model - help pages

孤街醉人 提交于 2019-12-03 07:40:38
问题 I'm busy creating a Web API (Inside a asp mvc4 application). I am using the library suggested on the asp.net site for generating documentation (http://www.asp.net/web-api/overview/creating-web-apis/creating-api-help-pages). My problem is that if my parameter is a model, then I can't specify what properties the model contains in the generated help pages. Here is an example: MODEL: public class TestModel { property String FirstName {get;set;} property String Surname {get; set;} property Boolean

ASP.Net Web Api - ApiExplorer does not contain any ApiDescriptions

我的未来我决定 提交于 2019-11-30 18:00:39
I am trying to implement an Options method in a controller of my web service that will return a message containing the valid HTTP methods for the URI endpoint associated with the controller. My Options method looks something like this: public HttpResponseMessage Options() { var resp = new HttpResponseMessage(); resp.Content = new StringContent(""); var apiExplorer = GlobalConfiguration.Configuration.Services .GetApiExplorer(); foreach (ApiDescription api in apiExplorer.ApiDescriptions) { resp.Content.Headers.Add("Allow", api.HttpMethod.Method); } return resp; } I have tried the above method in