Open hpanchal18 opened 7 years ago
At the moment only web api controllers are supported... Im not sure if odata works out of the box. But you surely can generate the dto schemas..
thanks for quick response. can you provide sample of global.asax App_start method so that i can configure swaggergenerator to generate documentation for WebApi controller? i do see sample with startup.cs but we are not using ASP.Net Core.
Thanks,
I tried code and configuration as specified. When i compile i expects to see swagger.json genetared. Is that correct assumption? When I tried to access swagger ui, I am able to get to ui but as it is looking for swagger.json and I do not get any routes documentation in ui. Am I missing any specific step ?
Just wanted to add this: this looks like a good project but to use it i need OData support. i would contibute if i could but my time is limited. i know that there is an OData module for swashbuckle which i am currently using.
Yes there is Swashbuckle.OData, if you could some how get access to the SwaggerDocsConfig of the underlying Swashbuckle middleware you and the HttpConfiguration could do
swaggerDocsConfig.CustomProvider(defaultProvider =>
{
return new ODataSwaggerProvider(defaultProvider, swaggerDocsConfig, httpConfiguration);
});
Also this issue is referenced in issue 730 as a duplicate but that one is about asp.net core odata (official WIP) and this one seems to be about .net framework WebAPI odata.
I'm currently working on a project based on this that uses the OData api explorer from the ASP.NET versioning project over at https://github.com/Microsoft/aspnet-api-versioning
I got a working prototype of this, it needs some work but in a few months time it should be fully done.
Note: it is based on the 3.0.0 version which means that versions below AspNet.OData 7 will not be compatible.
i have been able to get Odata working with swagger-net using api explorer V3 (pre-release build) i needed to make a few small changes to the swagger-net code to add some details to the swagger ui but in general it works. if Nswag just allows for OData api data to come from the api explorer it will work here also.
one caution note: the V3 code in api explorer may have some performance issues on larger sets of OData / EDM that need to be fixed. as i have time i am trying to help that get fixed but my time is limited. if you have a larger api using OData and if you have time see if you can debug it offer fixes to that project.
@figuerres Yeah, the biggest performance issue seems to be in getting matching clrtypes for the edm types, it loops through all types of all assemblies each time a type is required. I already have a solution for that using caching and a HashMap, I'll have a PR for that this week so be on the lookout for that and let me know if it helps :)
Ahhhh... Yes I see you are in the commits !!! yea!!! i have been so busy i have not had time to dive in but i have been posting , the topic is wrong for the posts so take a look at https://github.com/Microsoft/aspnet-api-versioning/issues/360
where i give some times and numbers of controllers and numbers of methods / api endpoints. i have been suspecting that the EDM models and following the references / relations has been a problem. if we can get the time to get the catalog down it will really help.
We have WebAPI for framework 4.5 that has oData controllers to serve the models. We are planning to use WebAPISwaggerGenerator to generate documentation on the fly during our development process. Can we use WebAPISwaggerGenerator for the same? if yes, can you provide some samples? if you have other options then please let us know.
Thanks,