In .NET 7, we added support for a new Microsoft.AspNetCore.OpenApi package that is designed to work with minimal API applications and provide constructs that allow users to directly modify the OpenApiOperation associated with their endpoints.
At the moment, the package integrates into Swashbuckle using an ad-hoc merge and replace strategy wherein:
If an OpenApiOperation exists in the endpoint metadata, it is used instead of using the one generated by SwaggerGenerator and
Swashbuckle's schema generator is leveraged to generate the OpenApiSchema since Microsoft.AspNetCore.OpenApi doesn't support full reflection schema generation to put
In the future, it would be great to unify this ad-hoc strategy, especially now that OpenAPI v3.1's OpenAPI schema exactly matches JSON schema (ref).
In .NET 7, we added support for a new
Microsoft.AspNetCore.OpenApi
package that is designed to work with minimal API applications and provide constructs that allow users to directly modify theOpenApiOperation
associated with their endpoints.At the moment, the package integrates into Swashbuckle using an ad-hoc merge and replace strategy wherein:
Microsoft.AspNetCore.OpenApi
doesn't support full reflection schema generation to putIn the future, it would be great to unify this ad-hoc strategy, especially now that OpenAPI v3.1's OpenAPI schema exactly matches JSON schema (ref).
Some possibilities include:
Microsoft.OpenApi
layer (see https://github.com/microsoft/OpenAPI.NET/issues/836)TypeInfoResolver
API (ref) to standardize on schema generationWith the long-term goal of:
WithOpenApi
invocations on route handler endpointscc: @domaindrivendev @darrelmiller