public static void SetupSwaggerDocs(
            this IServiceCollection services,
            DocsSettings docsSettings,
            ApiSettings apiSettings)
        {
            DocsSettings = docsSettings;

            if (DocsSettings?.Enabled == true)
            {
                DocsSettings.Version    = apiSettings.Version;
                DocsSettings.PathPrefix = apiSettings.PathPrefix;
                GenerateSwaggerUrl();

                services.AddSwaggerGen(options =>
                {
                    string readme = null;
                    if (string.IsNullOrWhiteSpace(DocsSettings.PathToReadme) == false)
                    {
                        readme = File.ReadAllText(DocsSettings.PathToReadme);
                    }

                    switch (apiSettings.JsonSerializer)
                    {
                    case JsonSerializerEnum.Camelcase:
                        options.SchemaFilter <CamelEnumSchemaFilter>();
                        break;

                    case JsonSerializerEnum.Snakecase:
                        options.SchemaFilter <SnakeEnumSchemaFilter>();
                        break;

                    case JsonSerializerEnum.Lowercase:
                        options.SchemaFilter <LowerEnumSchemaFilter>();
                        break;
                    }

                    options.OperationFilter <QueryAndPathCaseOperationFilter>();
                    options.DescribeAllEnumsAsStrings();
                    options.SwaggerDoc(apiSettings.Version, new Info
                    {
                        Title       = DocsSettings.Title,
                        Version     = apiSettings.Version,
                        Description = readme,
                        Contact     = new Contact
                        {
                            Name  = DocsSettings.AuthorName,
                            Email = DocsSettings.AuthorEmail
                        }
                    });
                });
            }
        }
        public static void SetupSwaggerDocs(
            this IServiceCollection services,
            DocsSettings docsSettings,
            ApiSettings apiSettings)
        {
            DocsSettings = docsSettings;

            if (DocsSettings?.Enabled == true)
            {
                DocsSettings.Version    = apiSettings.Version;
                DocsSettings.PathPrefix = apiSettings.PathPrefix;
                GenerateSwaggerUrl();

                services.AddSwaggerGen(options =>
                {
                    string readme = null;
                    try
                    {
                        if (string.IsNullOrWhiteSpace(DocsSettings.PathToReadme) == false)
                        {
                            readme = File.ReadAllText(DocsSettings.PathToReadme);
                        }
                    }
                    catch (Exception)
                    {
                        Console.WriteLine($"[ERROR] Swagger markdown ({DocsSettings.PathToReadme}) could not be loaded.");
                    }

                    switch (apiSettings.JsonSerializer)
                    {
                    case JsonSerializerEnum.Camelcase:
                        options.SchemaFilter <CamelEnumSchemaFilter>();
                        break;

                    case JsonSerializerEnum.Snakecase:
                        options.SchemaFilter <SnakeEnumSchemaFilter>();
                        break;

                    case JsonSerializerEnum.Lowercase:
                        options.SchemaFilter <LowerEnumSchemaFilter>();
                        break;
                    }

                    options.SchemaFilter <SnakeEnumSchemaFilter2>();

                    options.CustomSchemaIds(x => x.FullName);
                    options.CustomOperationIds(apiDesc =>
                    {
                        return(apiDesc.TryGetMethodInfo(out MethodInfo methodInfo)
                            ? methodInfo.Name : null);
                    });

                    options.OperationFilter <QueryAndPathCaseOperationFilter>();
                    options.SwaggerDoc(apiSettings.Version, new OpenApiInfo
                    {
                        Title       = DocsSettings.Title,
                        Version     = apiSettings.Version,
                        Description = readme,
                        Contact     = new OpenApiContact
                        {
                            Name  = DocsSettings.AuthorName,
                            Email = DocsSettings.AuthorEmail
                        }
                    });
                });
                services.AddSwaggerGenNewtonsoftSupport();
            }
        }