Overview
WebApiShard is an important shard that allows to expose Web API endpoints based on OpeAPI specifications.
Swashbuckle is used under the hood and you can find more technical information about OpenAPI, REST APIs and Swagger concepts on microsoft documentation.
WebApiShard comes with a WebApiSettings class that holds settings to configure the service.
To add the shard to the forge, the IForgeBuilder
extension UseApi
has to be called, passing optional options
to further configure the service
1 |
|
WebApiShard implements the Web API controllers using the standard aspnet ControllerBase class but decorates it with a set of default attributes needed to expose these controllers in the right context.
To create a proper WebApiShard controller, an abstract base class MithrilControllerBase
exists that applies already the required attributes.
1 2 3 4 |
|
Areas are used to subdivide APIs based on grouping criteria and each area can be enabled or disabled by configuring the corresponding ApiServiceDefinition.
By default two areas are defined but custom areas can be created easily.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Note
WebApiShard controllers have to belong to a specific area. More information in Creating a Controller section.
DisableByEndPointActionFilterAttribute
class, that's a registered ActionFilterAttribute, is responsible to enforce proper checks against executing an action on an unspecified, unknown or disabled area.
Warning
The current implementation may be subject to changes to implement the authentication and authorization layer.