Home OpenApiDocumentAttribute Class
OpenApiDocumentAttribute Class
Cancel

OpenApiDocumentAttribute Class

Namespace: Json.Schema.Api.OpenApi

Inheritance: OpenApiDocumentAttribute 🡒 Attribute 🡒 object

Places a controller’s endpoints in named OpenAPI descriptions rather than the default one.

Remarks

A controller without this attribute appears in the default description — the one configured by the AddOpenApi overload that takes no name. Applying the attribute moves the controller out of the default description and into the ones it names, so applying it to one controller does not change where any other controller appears.

Minimal APIs are always described in the default description. Splitting them is not supported.

Examples

1
2
3
4
5
6
            [OpenApiDocument("admin")]
            [ApiController]
            [Route("api/admin")]
            public class AdminController : ControllerBase;
            

Properties

NameTypeSummary
Namesstring[]Gets the names of the descriptions the controller appears in.
TypeIdobject 

Constructors

OpenApiDocumentAttribute(params string[] names)

Creates a new Json.Schema.Api.OpenApi.OpenApiDocumentAttribute.

Declaration

1
public OpenApiDocumentAttribute(params string[] names)
ParameterTypeDescription
namesparams string[]The names of the descriptions the controller appears in. A controller that belongs to more than one audience can name several.
Contents