-
Notifications
You must be signed in to change notification settings - Fork 705
API Explorer Options
The ApiExplorerOptions class allows you to configure, customize, and extend the default behaviors when you add API exploration support. The configuration options are specified by providing a callback to the appropriate extension method:
ASP.NET Web API
configuration.AddVersionedApiExplorer( options => { /* configure options */ } );
ASP.NET Web API with OData
configuration.AddODataApiExplorer( options => { /* configure options */ } );
ASP.NET Core
services.AddMvcCore().AddVersionedApiExplorer( options => { /* configure options */ } );
The ApiExplorerOptions class has the following configuration settings:
- GroupNameFormat
- DefaultApiVersion
- DefaultApiVersionParameterDescription
- AssumeDefaultVersionWhenUnspecified
- ApiVersionParameterSource
- UseApiExplorerSettings*
* Applies to ASP.NET Web API with OData only
The group name format is the format string that is applied to the current API version being explored. This resultant, formatted string is used as the group name for the explored API. The group name is often used in tools such as Swagger and Swashbuckle to logically group APIs together. For more information and examples on the format specifiers for an API version, see the Custom API Version Format Strings topic.
This option defines what the default ApiVersion will be for a service without explicit API version information. The default value is derived from ApiVersioningOptions.DefaultApiVersion and should not be changed.
This option defines what the default description for API version parameters will be. The default value is: "The requested API version".
This option enables support for clients to make requests with implicit API versioning. This option is used during API exploration to determine whether the API version parameter is required. The default value is derived from ApiVersioningOptions.AssumeDefaultVersionWhenUnspecified and should not be changed.
This option configures how the API exploration process discovers API version parameters. The default value derives from ApiVersioningOptions.ApiVersionReader and should not be changed.
This option only applies to ASP.NET Web API with OData. OData controllers are not explored by default. The API explorer for OData services does not initially honor this setting so that OData APIs will be discovered. You might decide, however, to use the API explorer settings to explicitly define which OData services should be explored. You must set this property to a value of true in order for the API explorer to respect API explorer settings.
- Home
- Quick Starts
- Version Format
- Version Discovery
- Version Policies
- How to Version Your Service
- API Versioning with OData
- Configuring Your Application
- Error Responses
- API Documentation
- Extensions and Customizations
- Known Limitations
- FAQ
- Examples