swashbuckle extension for schema mappings in a separate project
Describe the feature
Currently in order for the swashbuckle extension method to be generated the [assembly: VogenDefaults( openApiSchemaCustomizations: OpenApiSchemaCustomizations.GenerateSwashbuckleMappingExtensionMethod)] has to be put somewhere inside the project of the value objects. This means a hard dependency on Swashbuckle.AspNetCore.SwaggerGen and thus also on asp.net.core is required for the domain project.
I'd like to be able to generate the extension in my api project for all referenced value objects.
The workaround now is to write out the mappings manually in the api project and not use the extension method.
Thanks for the feedback @StealthyDeveloper - I've added partial support for this for Open API 2.0+
In your web api project, add something like this:
[OpenApiMarker<City>]
[OpenApiMarker<Age>]
[OpenApiMarker<Name>]
public partial class OpenApiMarkers;
Then, you can use:
builder.Services.AddOpenApi((OpenApiOptions o) =>
{
o.MapVogenTypesInOpenApiMarkers();
});
I'll add this feature to the next beta release if you'd like to try it?