/// <summary>
        /// Add Swagger support for Microservice.
        /// </summary>
        /// <param name="service"></param>
        public static void AddSwagger(this IServiceCollection services)
        {
            config = LightConfigurator.Config <SwaggerConfiguration>("Swagger");

            ///Fill all versions declareted
            services.AddSwaggerGen(c =>
            {
                foreach (var version in config.Versions)
                {
                    c.SwaggerDoc(version.Name, new Info
                    {
                        Version        = version.Name,
                        Title          = version.Info.Title,
                        Description    = version.Info.Description,
                        TermsOfService = version.Info.TermsOfService,
                        Contact        = new Contact {
                            Name = version.Info.Contact.Name, Email = version.Info.Contact.Email, Url = version.Info.Contact.Url
                        },
                        License = new License {
                            Name = version.Info.License.Name, Url = version.Info.License.Url
                        }
                    });
                }
                c.IgnoreObsoleteActions();

                ///Set the comments path for the swagger json and ui.
                var basePath = PlatformServices.Default.Application.ApplicationBasePath;
                var appName  = PlatformServices.Default.Application.ApplicationName;
                var xmlPath  = Path.Combine(basePath, $"{appName}.xml");
                c.IncludeXmlComments(xmlPath);

                c.SchemaFilter <SwaggerIgnoreFilter>();

                c.DocumentFilter <RemoveVerbsFilter>();

                c.AddSecurityDefinition("Bearer", new ApiKeyScheme()
                {
                    Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
                    Name        = "Authorization",
                    In          = "header",
                    Type        = "apiKey"
                });
                c.AddSecurityRequirement(new Dictionary <string, IEnumerable <string> >
                {
                    { "Bearer", new string[] {} }
                });

                c.EnableAnnotations();
            });
        }
        /// <summary>
        /// Use Swagger for Liquid Microservice.
        /// </summary>
        /// <param name="service"></param>
        public static IApplicationBuilder UseOpenApiSwagger(this IApplicationBuilder builder)
        {
            config = LightConfigurator.Config <SwaggerConfiguration>("Swagger");

            builder.UseSwaggerUI(c =>
            {
                ///Fill all versions declareted
                foreach (var version in config.Versions)
                {
                    c.SwaggerEndpoint($"/swagger/{version.Name}/swagger.json", $"{version.Name} Docs");
                }
            });

            return(builder);
        }
        /// <summary>
        /// Add API Versioning the default version is 1.0
        /// and we're going to read the version number from the media type
        /// incoming requests should have a accept header like this: Accept: application/json;v=1.0
        /// </summary>
        /// <param name="services"></param>
        /// <param name="majorVersion"></param>
        /// <param name="minorVersion"></param>
        public static void AddApiVersion(this IServiceCollection services)
        {
            config = LightConfigurator.Config <SwaggerConfiguration>("Swagger");
            var ver = config.Versions.FirstOrDefault(p => p.Name == config.ActiveVersion);

            if (ver != null)
            {
                services.AddApiVersioning(o =>
                {
                    o.DefaultApiVersion = new ApiVersion(int.Parse(ver.Info.Version), 0);
                    o.AssumeDefaultVersionWhenUnspecified = true;
                    o.ApiVersionReader = new MediaTypeApiVersionReader();
                });
            }
        }