OpenAPI
Decorators
Mark endpoints as secured or hidden.
Two annotations control who sees what in the documentation:
| Annotation | On | Effect |
|---|---|---|
@ApiBearerAuth | controller or handler | marks it as needing a bearer token; the Authorize button in the reference then sends it |
@ApiHidden | controller or handler | leaves it out of the reference and the export |
@Controller("/admin") @ApiBearerAuth @ApiHidden class InternalController { ... } // needs a token, and is not documented publicly@Authenticated,@Roleand@Rolesimply@ApiBearerAuth: an endpoint guarded that way is already shown as secured. Use the annotation for endpoints you protect in some other way (a guard of your own).- Hidden is not secret.
@ApiHiddenonly omits the endpoint from the docs. Protect it with a guard as usual. - Hide internal and operational endpoints (health, metrics, admin tools) from the public reference.
For the kind of authentication (bearer, API key, OAuth2) shown in the OpenAPI file see Security.