Skip to content

[OpenAPI] Refactor MapOpenApi #62194

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

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

martincostello
Copy link
Member

Refactor MapOpenApi

Refactor the MapOpenApi() method.

Description

Refactor the MapOpenApi() method to avoid two almost identical code blocks by assigning the differing values into variables and then using.

Subjective change, so feel free to close if you preferred it as it was.

Refactor the `MapOpenApi()` method to avoid two almost identical code blocks.
@martincostello martincostello requested review from captainsafia and a team as code owners May 31, 2025 15:08
@github-actions github-actions bot added the area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc label May 31, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 31, 2025
@martincostello martincostello requested a review from Copilot June 1, 2025 15:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the MapOpenApi method to reduce duplicate code by assigning the differing values into variables.

  • Removed duplicate calls to context.Response.StartAsync() and SerializeAsync for YAML and JSON paths
  • Introduced variables for content type and the OpenApiWriter instance for streamlined logic

@captainsafia captainsafia merged commit 040b4df into dotnet:main Jun 2, 2025
28 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview6 milestone Jun 2, 2025
@martincostello martincostello deleted the refactor-method branch June 2, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc community-contribution Indicates that the PR has been added by a community member feature-openapi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants