private void SetVersionAndComments(SwaggerDocsConfig config, string version, string title) { string str = string.Empty; try { config.SingleApiVersion(version, title); char[] trimChars = new char[] { '\\' }; str = AppDomain.CurrentDomain.BaseDirectory.Trim(trimChars); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (directoryName != null) { char[] chArray2 = new char[] { '\\' }; if (directoryName.Trim(chArray2) != str) { str = Path.Combine(str, "bin"); } } } catch { } if (!string.IsNullOrEmpty(str)) { foreach (string str3 in Directory.EnumerateFiles(str, "*.XML").ToArray <string>()) { config.IncludeXmlComments(str3); } } }
private static void EnableSwagger(SwaggerDocsConfig swaggerDocsConfig) { swaggerDocsConfig.SingleApiVersion(AppSettings.ApiVersion, $"{AppSettings.ApplicationName} {AppSettings.ApiVersion}"); swaggerDocsConfig.RootUrl(GetRootUrlFromAppConfig); swaggerDocsConfig.IncludeXmlComments(GetXmlCommentsPath()); swaggerDocsConfig.OperationFilter <SwaggerCorrelationIdHeader>(); swaggerDocsConfig.OperationFilter <FormatXmlCommentProperties>(); swaggerDocsConfig.OperationFilter <SwaggerAuthorizationHeader>(); }
private static void Configure(SwaggerDocsConfig swaggerConf) { //todo reflection swaggerConf.SingleApiVersion("v1", "My Thai Star Email Service"); //Add swagger documentation foreach (var doc in GetXmlDocumentsForSwagger()) { swaggerConf.IncludeXmlComments(GetXmlCommentsPath(doc)); } }
internal static SwaggerDocsConfig GetDefaultConfigWithTRex() { SwaggerDocsConfig config = new SwaggerDocsConfig(); config.SingleApiVersion("v1", "TRexTestApi"); config.ReleaseTheTRex(); config.OperationFilter <IncludeParameterNamesInOperationIdFilter>(); return(config); }
protected void SetUpHandler(Action <SwaggerDocsConfig> configure = null) { var swaggerDocsConfig = new SwaggerDocsConfig(); swaggerDocsConfig.SingleApiVersion("v1", "Test API"); swaggerDocsConfig.IncludeAllXmlComments(typeof(SwaggerTestBase).Assembly, AppDomain.CurrentDomain.BaseDirectory); configure?.Invoke(swaggerDocsConfig); Handler = new SwaggerDocsHandler(swaggerDocsConfig); }
/// <summary> /// Configures Swagger and how it integrates into the Http Server /// </summary> /// <param name="docsConfig"></param> private static void ConfigureSwagger(SwaggerDocsConfig docsConfig) { var assemblyName = Assembly.GetExecutingAssembly().GetName(); docsConfig.SingleApiVersion(assemblyName.Version.ToString().Replace('.', '_'), $"{assemblyName.Name}.API"); docsConfig.IncludeXmlComments(HostingEnvironment.MapPath($"~/bin/{assemblyName.Name}.xml")); docsConfig.UseFullTypeNameInSchemaIds(); // This line is specifically for running this api in a virtual directory // See https://github.com/domaindrivendev/Swashbuckle/issues/305 docsConfig.RootUrl(req => req.RequestUri.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/").TrimEnd('/')); }
protected void SetUpHandler(Action <SwaggerDocsConfig> configure = null) { var swaggerDocsConfig = new SwaggerDocsConfig(); swaggerDocsConfig.SingleApiVersion("v1", "Test API"); configure?.Invoke(swaggerDocsConfig); Handler = new SwaggerDocsHandler(swaggerDocsConfig) { IsAuthenticated = () => true }; }
public void SetUpHandler(Action <SwaggerDocsConfig> configure = null) { var swaggerDocsConfig = new SwaggerDocsConfig(); swaggerDocsConfig.SingleApiVersion("v1", "Test API"); if (configure != null) { configure(swaggerDocsConfig); } Handler = new SwaggerDocsHandler(swaggerDocsConfig); }
internal static void Configure(HttpConfiguration config) { var swConfig = new SwaggerDocsConfig(); swConfig.RootUrl(m => GetOwinAppBasePath(m.GetOwinContext())); swConfig.OperationFilter(() => new ODataResponcesOperationFilter()); swConfig.OperationFilter(() => new AddExtendedMetadataOperationFilter()); swConfig.DocumentFilter(() => new ODataRemoveNotAllowedOperationFilter()); swConfig.SingleApiVersion("v2", "BlackCoffeeTalk oData Services"); swConfig.CustomProvider(defaultProvider => new ODataSwaggerProvider(defaultProvider, swConfig, config) .Configure(odatasw => { odatasw.EnableSwaggerRequestCaching(); odatasw.IncludeNavigationProperties(); })); swConfig.ApiKey("Token") .Description("Filling bearer token.") .Name("Authorization") .In("header"); config.Routes.MapHttpRoute("swagger_docs", "", new { apiVersion = "v2" }, null, new SwaggerDocsHandler(swConfig)); }
public static void SetupSwaggerConfig(SwaggerDocsConfig swaggerDocsConfig) { Contract.Requires(swaggerDocsConfig != null); swaggerDocsConfig.SingleApiVersion("v1", "Api_Learn"); }
public static void SetupSwaggerConfig(SwaggerDocsConfig swaggerDocsConfig) { Contract.Requires(swaggerDocsConfig != null); swaggerDocsConfig.SingleApiVersion("v1", "magic_application_name_magic"); }
private static void UpdateConfig(SwaggerDocsConfig c) { c.Schemes(new[] { "http", "https" }); c.SingleApiVersion("v1", "DemoAPI").Description("Specification for Demo API"); }
public void ConfigureSwagger(SwaggerDocsConfig config) { config.SingleApiVersion("v1", "HomeLibrary"); logger.Debug("Swagger doc config completed ..."); }
private static void Configure(string version, SwaggerDocsConfig config) { config.SingleApiVersion(version, "Demo.Api"); config.UseFullTypeNameInSchemaIds(); }
private static void Configure(SwaggerDocsConfig config) { config.SingleApiVersion("V1", "Komplett.MobileSignUp.Api"); }
public void ConfigureSwagger(SwaggerDocsConfig config) { config.SingleApiVersion("v1", Service.GetName()); logger.Debug("Swagger doc config completed ..."); }
public static void SetupSwaggerConfig(SwaggerDocsConfig swaggerDocsConfig) { Contract.Requires(swaggerDocsConfig != null); swaggerDocsConfig.SingleApiVersion("v1", "magic_api_app_title_magic"); }
private void ConfigureSwaggerDocs(SwaggerDocsConfig swaggerDocsConfig) { swaggerDocsConfig.SingleApiVersion("v1", this.GetType().Assembly.GetName().Name); swaggerDocsConfig.UseFullTypeNameInSchemaIds(); }