-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Add doc on excluding endpoints in controller-based apps #33773
base: main
Are you sure you want to change the base?
Conversation
|
||
In controller-based apps, the <xref:Microsoft.AspNetCore.Mvc.ApiExplorerSettingsAttribute> attribute can be used to exclude an endpoint from the OpenAPI document. | ||
|
||
The following example demonstrates how to exclude an endpoint from the generated OpenAPI document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add that this also applies for committing entire controller classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM outside of one small nit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider my suggestions.
Let me know when we can S&M, or you can merge when you're ready.
By default, all endpoints that are defined in an app are documented in the generated OpenAPI file, | ||
but endpoints can be excluded from the document using attributes or extension methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, all endpoints that are defined in an app are documented in the generated OpenAPI file, | |
but endpoints can be excluded from the document using attributes or extension methods. | |
By default, all endpoints that are defined in an app are documented in the generated OpenAPI file, but endpoints can be excluded from the document using attributes or extension methods. |
|
||
By default, all endpoints that are defined in an app are documented in the generated OpenAPI file. Minimal APIs support two strategies for excluding a given endpoint from the OpenAPI document, using: | ||
The mechanism for specifying an endpoint should be excluded depends on the type of app being developed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mechanism for specifying an endpoint should be excluded depends on the type of app being developed. | |
The mechanism for specifying an endpoint that should be excluded depends on the type of app being developed. |
|
||
##### [Minimal APIs](#tab/minimal-apis) | ||
|
||
Minimal APIs support two strategies for excluding a given endpoint from the OpenAPI document, using: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimal APIs support two strategies for excluding a given endpoint from the OpenAPI document, using: | |
Minimal APIs support two strategies for excluding a given endpoint from the OpenAPI document: |
|
||
In controller-based apps, the <xref:Microsoft.AspNetCore.Mvc.ApiExplorerSettingsAttribute> attribute can be used to exclude an endpoint from the OpenAPI document. | ||
|
||
The following example demonstrates how to exclude an endpoint from the generated OpenAPI document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following example demonstrates how to exclude an endpoint from the generated OpenAPI document. | |
The following example demonstrates how to exclude an endpoint from the generated OpenAPI document: |
This PR updates the section of the OpenAPI doc on excluding endpoints to describe how this can be done in controller-based apps.
fixes: dotnet/aspnetcore#57425
Internal previews