Remove "Send Empty Value" Checkbox in Swagger UI using .net core

Viewed 1618

I having difficulty removing "Send Empty Value" checkbox in Swagger UI using .netcore. Is there any problem with my current codes?

Swagger UI Sample "Send Empty Value":

Swagger UI Sample "Send Empty Value"

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
    services.AddSwaggerGen(_ =>
    {
        _.SwaggerDoc("v1", new OpenApiInfo
        {
            Version = "v1",
            Title = "Communications Engine Send Message Endpoint",
            Description = "A Web API endpoint designed for accepting user request to send email with different supported providers."
        });

        // Set the comments path for the Swagger JSON and UI.
        var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
        var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
        _.IncludeXmlComments(xmlPath);

        _.OperationFilter<AddRequiredHeaderParameter>();
        _.OperationFilter<ReApplyOptionalRouteParameterOperationFilter>();
    });

    services.AddModelBindingErrorHandling();
}
0 Answers
Related