-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Support IOpenApiDocumentProvider (was executing IApiPublisher
implementors during application run)
#61031
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
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Nit: This should just be
Would this just prevent the Also, could this also be used to implement things like EF Core tooling? I'm not saying we'd actually do that since Given the shape of the API, I wonder if we could add an |
The former. This just prevents the
I'm not totally familiar with how the EF Core tooling works but this can be used to replace anything that relies on
FWIW, I put the type in the abstractions assembly in the shared framework instead of the
I haven't gone this far down with abstracting this API. I can see this make sense for certain builders where there is a "live" mode for the application (like running an HTTP server and listening on ports) and a "static" mode but I haven't reasoned through how that shape would look for all host types. |
API Review Notes:
API Approved! (No publisher!) // Assembly: Microsoft.AspNetCore.OpenApi
namespace Microsoft.AspNetCore.OpenApi;
public interface IOpenApiDocumentProvider
{
Task<OpenApiDocument> GetOpenApiDocumentAsync(CancellationToken cancellationToken = default)
} |
IApiPublisher
implementors during application runIApiPublisher
implementors during application run~ IOpenApiDocumentProvider
IApiPublisher
implementors during application run~ IOpenApiDocumentProviderIApiPublisher
implementors during application run)
Closing as this was addressed in #61463 |
Uh oh!
There was an error while loading. Please reload this page.
Background and Motivation
Currently, if a user wants to run the startup logic associated with an application without launching an actual application service, they must use the
HostFactoryResolver
to launch the application and inject a no-opIServer
implementation into the DI container. This helps users achieve the desired goal of launching the application without actually listening to HTTP requests and is a helpful vector for entites that want to execute some logic on the state of the application. One of our most popular scenarios for this is the need to launch the application in order to resolve endpoints that should be mapped to an OpenAPI document.This proposal takes inspiration from Aspire's IDistributedApplicationPublisher interface and infrastructure to provide a more streamlined API for interacting with the application without listening on an HTTP server.
Proposed API
Although the IApiPublisher feature is not specific to OpenAPI support, the following API addition is proposed to make it easier to interact with the in-memory OpenAPI document from
IApiPublisher
implementations.Usage Examples
Alternative Designs
IApplicationPublisher
orIWebApplicationPublisher
since none of the behavior is strictly API specific.ApplicationRunMode
enum and property that allows users to inspect whether an application is running in publish or server mode.Risks
Although users can do this currently with a
HostFactoryResolver
+ no-opIServer
implementation, this does make it much easier to launch an ASP.NET Core app without listening on any ports which might expose uninteded behavior in certain scenarios that assume a server is running.The text was updated successfully, but these errors were encountered: