OpenAPI.NET.OData
OpenAPI.NET.OData copied to clipboard
Expose a middleware to output Open API description for a certain OData service
Maybe we can have an extension middleware to expose the OpenAPI description for a certain OData service.
For example:
public class ODataOpenApiMiddleware
{
private readonly RequestDelegate next;
public ODataOpenApiMiddleware(RequestDelegate next)
{
this.next = next;
}
public async Task Invoke(HttpContext context)
{
// implementation here
}
}
Extension method:
public static IApplicationBuilder UseODataOpenApi(this IApplicationBuilder app)
{
return app.UseMiddleware<ODataOpenApiMiddleware>();
}
Configure the Middleware:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseODataOpenApi();
app.UseRouting();
app.UseEndpoints(...);
}
This would be a very useful middleware and will help feed swagger.json files to the openapi explorer
@xuzhg Wouldn't it make more sense for that middleware to be in here https://github.com/OData/AspNetCoreOData ?
@darrelmiller actually, we already have a sample for OpenApi OData middelware at https://github.com/OData/AspNetCoreOData/tree/main/sample/ODataRoutingSample/OpenApi.
It's for raw OpenAPI description of OData. Thanks.
I don't believe that this library should be implementing features that are dependent on ASP.Net.