Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Swagger Generator Does Not Use All API Explorer Metadata

Open commonsensesoftware opened this issue 7 years ago • 18 comments

Overview

The implementation of SwaggerGenerator.cs should consider all relevant metadata provided by API explorers. The following information is not currently mapped in all NonBodyParameter scenarios:

  • Required - this can be determined by location and by ApiParameterDescription.RouteInfo.IsOptional
  • Description - this can be determined by ApiParameterDescription.ModelMetadata.Description, when available
  • Default - this can be determined by ApiParameterDescription.RouteInfo.DefaultValue

Scenarios

There are undoubtedly numerous scenarios where this woudl be useful. In the case of API Versioning, this will enable discovered API version parameters to be injected into Swagger documents and the UI via its API explorer extensions without requiring additional configuration from service authors. Service authors must currently use custom IOperationFilter implementations to bridge this gap.

commonsensesoftware avatar Jun 07 '17 18:06 commonsensesoftware