Skip to content

Add example for skipping AllowAnonymous endpoints in OpenAPI docs#36902

Merged
wadepickett merged 6 commits intodotnet:mainfrom
Mohammed-Atef2004:openapi-allowanonymous-exampleR
Mar 20, 2026
Merged

Add example for skipping AllowAnonymous endpoints in OpenAPI docs#36902
wadepickett merged 6 commits intodotnet:mainfrom
Mohammed-Atef2004:openapi-allowanonymous-exampleR

Conversation

@Mohammed-Atef2004
Copy link
Contributor

@Mohammed-Atef2004 Mohammed-Atef2004 commented Mar 20, 2026

Description

Adds a practical example demonstrating how to conditionally apply security requirements in OpenAPI using an IOpenApiOperationTransformer.

Specifically, this shows how to skip endpoints decorated with [AllowAnonymous], which is a common real-world scenario not clearly covered in the current documentation.

This complements existing documentation improvements by providing a focused, end-to-end example.

Related Issue

Fixes #36904
Fixes dotnet/aspnetcore#61264 (Upstream doc issue originally referred to on the product repo)


Internal previews

📄 File 🔗 Preview link
aspnetcore/fundamentals/openapi/customize-openapi.md Customize OpenAPI documents

@Mohammed-Atef2004
Copy link
Contributor Author

@dotnet-policy-service agree

@wadepickett wadepickett self-requested a review March 20, 2026 17:53
@wadepickett wadepickett self-assigned this Mar 20, 2026
Added missing code fence closure on example.
Update the ms.date to show the article has recently changed.
@wadepickett wadepickett requested a review from mikekistler March 20, 2026 18:18
@wadepickett
Copy link
Contributor

Looks great! Thanks @Mohammed-Atef2004!!

I only found a few minor items, noted.

Mohammed-Atef2004 and others added 3 commits March 20, 2026 20:21
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
@Mohammed-Atef2004
Copy link
Contributor Author

Mohammed-Atef2004 commented Mar 20, 2026

@wadepickett wadepickett Applied the suggestion, Thank you for your comments

@wadepickett
Copy link
Contributor

@Mohammed-Atef2004 thanks!

Great work!

I'll give @mikekistler some time to get a chance to review before merging.

Copy link
Contributor

@wadepickett wadepickett left a comment

Choose a reason for hiding this comment

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

Reviewed and approved after some suggestions added.

@Mohammed-Atef2004
Copy link
Contributor Author

Sounds good! Thank you @wadepickett for the guidance and the kind words. I'll be standing by for @mikekistler review.

@wadepickett wadepickett merged commit b0aa907 into dotnet:main Mar 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Customize OpenAPI: add example for AllowAnonymous endpoints [OpenAPI] Cannot skip SecurityScheme for controllers with [AllowAnonymous]

2 participants