mattfrear/Swashbuckle.AspNetCore.Filters

Examples are not generated for swagger.json when using Swashbuckle.AspnetCore.Cli or using VS2019 built-in OpenApiGenerator in csproj

Rookian opened this issue · 1 comments

I am using the latest version '7.0.2' of Swashbuckle.AspNetCore.Filters.

No matter if I use Swashbuckle.AspNetCore.Cli or VS2019 built-in OpenApiGenerator (OpenApiGenerateDocumentsOnBuild, GenerateDocumentationFile, ...) option in csproj, the examples are not generated.

Examples are only visible in SwaggerUI.

I already checkout the tests for Swashbuckle.AspNetCore. There they are using an ExamplesSchemaFilter which is based on ISchemaFilter and it is working. When I replace the filter with an IExampleProvider it is not working anymore.

Am I missing something? Is IExampleProvider even supported by the OpenApi generator tools?

Replaced services.AddSwaggerExamplesFromAssemblies(Assembly.GetEntryAssembly()); with services.AddSwaggerExamplesFromAssemblies(Assembly.GetExecutingAssembly());