Open Yavor81 opened 7 years ago
Duplicate: https://github.com/NSwag/NSwag/issues/669
I think this is doable without much effort, however I am currently working on other parts of NSwag... Can you provide some sample controllers so that I can check this? Is there some documentation for this unofficial package?
Hi, Thank you for your quick reply. I cannot find any documentation for this package. Probably the reason is that it is just a wrapper around the non .NET Core implementation. Here is a sample project that I am using as a guide for setting up the pipeline to use the OData protocol. It is not using the above-mentioned package directly but something similar, which is home-grown, The idea, however, is the same.
Hi again, Is there any information about the NSwag application model, how the entire flow goes. I am evaluating the effort to add OData support for NSwag, how complex it would be.
A few weeks ago Microsoft has released .Net Core version of OData WebApi library (https://www.nuget.org/packages/Microsoft.AspNetCore.OData/7.0.0-beta1). No need for unofficial package anymore.
They use ODataQueryOptions
A second option - EnableQuery attribute on the action.
Controller action sample:
public async Task<IActionResult> GetAsync(
ODataQueryOptions<User> options,
CancellationToken cancellationToken = default(CancellationToken))
{
IQueryable<User> users = await _userManager.QueryAsync(cancellationToken);
return PageResult(users, options);
}
This is very interesting. The implementation in http://swashbuckleodata.azurewebsites.net/swagger/ui/index is what I'm interested to. I'm using Microsoft.AspNetCore.OData and I'm wondering how to install Swashbuckle.OData, because it seems to me it workd with Swashbuckle instead of Swashbuckle.AspNetCore. Does anyone had installe Swashbuckle.OData with Swashbuckle.AspNetCore?
Best
@RSuter I'm interested too in using NSwag in combination with the official Microsoft.AspNetCore.OData package (currently at v7.0.1). I see the SO question but have you already tried it without issues or are you planning to give an official support in NSwag for OData?
Thanks!
an item to note is that so far i have only found Swashbuckle to have an Option for OData and swashbuckle has problems with securing access to the pages. for really main stream use i think both are needed. Some folks may not like OData but used right it can help with data access.
Hi, Do you plan to add support for generating Swagger spec when using OData controllers in ASP.NET Core app? As you probably know, OData provides a uniform way to query and manipulate data sets through CRUD operations. I am currently using this package (unofficial) for enabling OData controllers but I want to add support for this protocol in the generated swagger spec using NSwag. I see with another OData enabled Swagger spec (via Swashbuckle.OData) that NSwag client code generation manages to handle these endpoints, once they are defined correctly. The question is how to add support for OData on the server side when using the .UseSwaggerUi middleware in ASP.NET Core?