-
Notifications
You must be signed in to change notification settings - Fork 708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does .NET 9's OpenApi support render this obsolete? #1115
Comments
@armanossiloko There was a little bit of conversation around this issue when I took a stab at updating our eShop sample app, which uses ASP.NET versioning, to use the new OpenAPI package in dotnet/eShop#360 (comment). Ultimately, the (ugly) resolution that we landed on in that PR is to declare the versions up front as you mentioned. At the time, @commonsensesoftware mentioned having some ideas around API changes to make in Asp.Versioning to support easier resolution of documents. I think I also recall some ideas thrown around for an |
@captainsafia Thanks for digging that up and refreshing my memory. @armanossiloko at this very moment I don't have a working example I can show. What you should need to do is use a
Actually, you'd be wrong, but that's ok. It's common misunderstanding. I've always been the sole owner, maintainer, documenter, etc of API Versioning. I was once a Microsoft employee so in that sense it was Microsoft. When I left, the transition was less than smooth. There was a lot of things that had to change such as moving the project under the .NET Foundation and renaming packages. All that being said, I've had, and continue to have, a good working relationship with the ASP.NET team, but I've never been part of the team and they've never been co-owners of API Versioning - despite the name. I hope that clears that up. 😉 |
Looking at the source code for OpenApi, I'm pretty certain you can't do this. AspNetCore adds keyed singleton services keyed by the API name, and registers multiple |
In the recently released .NET 9, there's built in support for generating openapi documents. However, these documents have to be predefined by specifying
services.AddOpenApi();
.This means that all API document names have to be defined in advance before the
IServiceProvider
is even built. This seems to totally "break" the flow of theAsp.Versioning.Mvc.ApiExplorer
package. If I am not wrong, it was Microsoft themselves who delegated the originalMicrosoft.AspNetCore.Mvc.Versioning
to the community which ended up turning into thisaspnet-api-versioning
.Since documents have to be known in advance now and this package was basically providing an
IApiVersionDescriptionProvider
in runtime, does .NET 9's default OpenApi document generation renderaspnet-api-versioning
obsolete? None of what Micorosft provided with .NET 9 seems to display proper versioning support at all, just some different ways to generate documents at build time. Is there a way to integrate this with .NET 9's default OpenApi support now or am I missing something here?The text was updated successfully, but these errors were encountered: