Skip to content
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

Move OpenAPI extension methods to M.A.Builder namespace #42445

Closed
captainsafia opened this issue Jun 27, 2022 · 2 comments · Fixed by #42469
Closed

Move OpenAPI extension methods to M.A.Builder namespace #42445

captainsafia opened this issue Jun 27, 2022 · 2 comments · Fixed by #42469
Labels
api-approved API was approved in API review, it can be implemented area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone

Comments

@captainsafia
Copy link
Member

captainsafia commented Jun 27, 2022

Background and Motivation

In preview4, we introduced support for an OpenAPI package that included extension methods on the then RouteHandlerBuilder (now IEndpointBuilder) for constructing an OpenApiOperation from an endpoint. These extension methods were placed in the Microsoft.AspNetCore.OpenApi namespace.

For consistency with the rest of the ecosystem, we want to move these extension methods to the Microsoft.AspNetCore.Builder namespace.

Proposed API

- namespace Microsoft.AspNetCore.OpenApi;
+ namespace Microsoft.AspNetCore.Builder;

public static class OpenApiRouteHandlerBuilderExtensions
{
  ...
}

Usage Examples

Before Change

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.OpenApi;

var app = WebApplication.Create();
app.UseRequestDecompression();
app.MapGet("/", ...).WithOpenApi();

With Change

using Microsoft.AspNetCore.Builder;
// No additional namespace references needed

var app = WebApplication.Create();
app.UseRequestDecompression();
app.MapGet("/", ...).WithOpenApi();

Alternative Designs

Not applicable.

Risks

None, API waas introduced in .NET 7 so no risk of breaking change and delta allows us to confirm with the standard for builder extension methods elsewhere.

@captainsafia captainsafia added api-suggestion Early API idea and discussion, it is NOT ready for implementation api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews and removed api-suggestion Early API idea and discussion, it is NOT ready for implementation labels Jun 27, 2022
@ghost
Copy link

ghost commented Jun 27, 2022

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:

  • The PR contains changes to the reference-assembly that describe the API change. Or, you have included a snippet of reference-assembly-style code that illustrates the API change.
  • The PR describes the impact to users, both positive (useful new APIs) and negative (breaking changes).
  • Someone is assigned to "champion" this change in the meeting, and they understand the impact and design of the change.

@captainsafia captainsafia changed the title Move OpenAPI extension methods to Builder namespace Move OpenAPI extension methods to M.A.Builder namespace Jun 27, 2022
@captainsafia captainsafia added this to the 7.0-preview7 milestone Jun 27, 2022
@BrennanConroy
Copy link
Member

BrennanConroy commented Jun 27, 2022

API review notes:

  • Noticed two OpenApiRouteHandlerBuilderExtensions types, let's rename this one to something like OpenApiEndpointConventionBuilderExtensions
+ namespace Microsoft.AspNetCore.Builder;

- public static class OpenApiRouteHandlerBuilderExtensions
+ public static class OpenApiEndpointConventionBuilderExtensions
{
  ...
}

API approved!

@BrennanConroy BrennanConroy added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews labels Jun 27, 2022
@Pilchie Pilchie added the area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Jun 28, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants