-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Make DelegateEndpointConventionBuilder constructors public #36492
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
Conversation
src/Http/Routing/src/Builder/DelegateEndpointConventionBuilder.cs
Outdated
Show resolved
Hide resolved
|
Thank you for your API proposal. I'm removing the |
|
@dotnet/aspnet-build Can I get help merging? The Linux helix run has passed for this but the other legs are stuck: https://helix.dot.net/api/jobs/cfb0e973-8053-41c1-a5be-8e37deee1a86/workitems?api-version=2019-06-17 Edit: Actually looks like all the Helix legs passed successfully |
|
Do not merge this as-is |
|
See The Shipped files should never change except immediately after an RTM release e.g. 6.0.0. In between, change PublicAPI.Unshipped.txt files. Add |
| *REMOVED*Microsoft.AspNetCore.Routing.RouteNameMetadata.RouteName.get -> string! | ||
| *REMOVED*Microsoft.AspNetCore.Routing.RouteNameMetadata.RouteNameMetadata(string! routeName) -> void | ||
| Microsoft.AspNetCore.Builder.DelegateEndpointConventionBuilder | ||
| Microsoft.AspNetCore.Builder.DelegateEndpointConventionBuilder.DelegateEndpointConventionBuilder(System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Builder.IEndpointConventionBuilder!>! endpointConventionBuilders) -> void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put another way: Unless this was in 5.0.0, the method hasn't shipped.
* Make DelegateEndpointConventionBuilder constructors public * Address API review feedback * Only expose a single constructor
…36549) * Make DelegateEndpointConventionBuilder constructors public (#36492) * Make DelegateEndpointConventionBuilder constructors public * Address API review feedback * Only expose a single constructor * Update src/Http/Routing/src/Builder/DelegateEndpointConventionBuilder.cs Co-authored-by: Pranav K <[email protected]> Co-authored-by: Pranav K <[email protected]>
Background and Motivation
For .NET 6, we added support for OpenAPI extension methods on the
DelegateEndpointConventionBuilderused in minimal apps. TheDelegateEndpointConventionBuilderis currently implemented as apublic sealedclass withinternalconstructors.While debugging a scenario, we realized that this posed a problem for scenarios where developers wanted to use the extension methods on a builder returned from a 3rd-party API or external source.
Proposed API
namespace Microsoft.AspNetCore.Builder { public class DelegateEndpointConventionBuilder { - internal DelegateEndpointConventionBuilder(List<IEndpointConventionBuilder> endpointConventionBuilders) + public DelegateEndpointConventionBuilder(List<IEndpointConventionBuilder> endpointConventionBuilders) }Usage Examples
Alternative Designs
One alternative is to have the extension methods target
IEndpointConventionBuilderinstead ofDelegateEndpointConventionBuilderbut this presents some problems because:Produces<TResponse>(TBuilder)Risks
DelegateEndpointConventionBuilderwas introduced in .NET 6 so this is not a breaking change.IEndpointConventionBuilders theDelegateEndpointConventionBuilderhas a requirement for this type of extensibility so it's the only one that follows the pattern of public class and public constructor.