Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[release/9.0] Fix handling for inert route parameters in MVC endpoints for OpenAPI #58311

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 9, 2024

Description

Backport of #58246 to release/9.0.

This PR makes the OpenAPI implementation more resilient to "inert route parameters" in MVC. Inert route parameters appear in the route template but are never bound to in the route handler. For example:

[Route("/api/{version}/{id})]
public void GetItem(int id) { } // `id` doesn't appear here

This pattern happens frequently when users integrate with the API versioning package which uses inert route parameters to distinguish between different versions of an API.

Fixes #58219

Customer Impact

Without this PR, customers are not able to generate OpenAPI specs for APIs that are versioning with the API versioning package and use version numbers in the URL.

There are no workarounds for this issue.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Change is localized to OpenAPI package and makes the package more resilient to bad inputs.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@github-actions github-actions bot requested review from captainsafia and a team as code owners October 9, 2024 04:20
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Oct 9, 2024
@captainsafia captainsafia changed the title [release/9.0] Fix handling for inert route parameters in MVC [release/9.0] Fix handling for inert route parameters in MVC endpoints for OpenAPI Oct 11, 2024
@captainsafia captainsafia added feature-openapi Servicing-approved Shiproom has approved the issue labels Oct 11, 2024
@captainsafia
Copy link
Member

Approved via email.

@wtgodbe wtgodbe merged commit 5d995b6 into release/9.0 Oct 14, 2024
25 checks passed
@wtgodbe wtgodbe deleted the backport/pr-58246-to-release/9.0 branch October 14, 2024 16:01
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0.0 milestone Oct 14, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants