Skip to content

Add SkipStatusCodePages property to ApiBehaviorOptions - #68098

Open
aw0lid wants to merge 1 commit into
dotnet:mainfrom
aw0lid:feat/skip-status-code-pages-api-behavior-#45369
Open

Add SkipStatusCodePages property to ApiBehaviorOptions#68098
aw0lid wants to merge 1 commit into
dotnet:mainfrom
aw0lid:feat/skip-status-code-pages-api-behavior-#45369

Conversation

@aw0lid

@aw0lid aw0lid commented Jul 29, 2026

Copy link
Copy Markdown

Add SkipStatusCodePages property to ApiBehaviorOptions

Description

This PR implements the approved API proposal to add the SkipStatusCodePages property to ApiBehaviorOptions.

What was done:

  • API Extension: Added the SkipStatusCodePages boolean property to ApiBehaviorOptions.
  • Application Model Provider: Updated ApiBehaviorApplicationModelProvider to check if SkipStatusCodePages is set to true. When enabled and targeting an API Controller (ApiControllerAttribute), it automatically injects SkipStatusCodePagesMetadata.Instance into the action's route selectors.
  • Public API: Updated PublicAPI.Unshipped.txt to include the new property.

Tests Added:

Added unit tests in ApiBehaviorApplicationModelProviderTest.cs covering the following scenarios:

  • Verifying metadata is added when SkipStatusCodePages = true on an API Controller.
  • Verifying metadata is not added when SkipStatusCodePages = true on a non-API Controller.
  • Verifying metadata is not added by default when SkipStatusCodePages = false.

Fixes #45369

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 29, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @aw0lid. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@aw0lid
aw0lid marked this pull request as ready for review July 30, 2026 07:09
@aw0lid
aw0lid requested a review from a team as a code owner July 30, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Add SkipStatusCodePages property to ApiBehaviorOptions

1 participant