public static void Customize() { SwaggerSpecConfig.Customize(c => { c.IgnoreObsoleteActions = true; c.SubTypesOf <Product>() .Include <Book>() .Include <Album>() .Include <Service>(); c.SubTypesOf <Service>() .Include <Shipping>() .Include <Packaging>(); c.PostFilter <AddStandardErrorCodes>(); c.PostFilter <AddAuthorizationErrorCodes>(); c.OperationFilter <ApplyCustomResponseTypes>(); // Uncomment below to support documentation from Xml Comments // c.PostFilter(new ExtractXmlComments()); }); SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.List; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.AddOnCompleteScript(typeof(SwaggerConfig).Assembly, "Swashbuckle.TestApp.SwaggerExtensions.onComplete.js"); c.AddStylesheet(typeof(SwaggerConfig).Assembly, "Swashbuckle.TestApp.SwaggerExtensions.customStyles.css"); }); }
public static void Register(HttpConfiguration config) { Swashbuckle.Bootstrapper.Init(config); // config.Routes.MapHttpRoute( // "swagger_versioned_api_docs", // "swagger/{apiVersion}/api-docs/{resourceName}", // new { resourceName = RouteParameter.Optional }, // null, // new SwaggerSpecHandler()); //config.Routes.MapHttpRoute( // "swagger_api_docs", // "swagger/api-docs/{resourceName}", // new { resourceName = RouteParameter.Optional }, // null, // new SwaggerSpecHandler()); SwaggerSpecConfig.Customize(c => { c.IgnoreObsoleteActions(); c.GroupDeclarationsBy(ResolveResourceName); c.ResolveBasePathUsing(ResolveBasePath); c.IncludeXmlComments(HostingEnvironment.MapPath("~/App_Data/Northwind.Api.xml")); }); SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.List; //var ass = Assembly.GetExecutingAssembly(); //string[] names = ass.GetManifestResourceNames(); c.CustomRoute("index.html", Assembly.GetExecutingAssembly(), "Northwind.Api.Swaggerui.index.html"); }); }
public static void Register(HttpConfiguration config) { Swashbuckle.Bootstrapper.Init(config); SwaggerSpecConfig.Customize(c => { c.ResolveTargetVersionUsing((req) => "2.0"); c.IgnoreObsoleteActions(); c.PolymorphicType <Product>(pc => pc .DiscriminateBy(p => p.Type) .SubType <Book>() .SubType <Album>() .SubType <Service>(sc => sc .SubType <Shipping>() .SubType <Packaging>())); c.OperationFilter <AddStandardResponseCodes>(); c.OperationFilter <AddAuthResponseCodes>(); c.IncludeXmlComments(GetXmlCommentsPath()); }); SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.List; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.InjectJavaScript(typeof(SwaggerConfig).Assembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js"); c.InjectStylesheet(typeof(SwaggerConfig).Assembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css"); }); }
public void FixtureSetup() { SwaggerUiConfig.Customize(c => { c.ApiKey = "TestApiKey"; c.ApiKeyName = "TestApiKeyName"; c.SupportHeaderParams = true; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.DocExpansion = DocExpansion.Full; c.AddOnCompleteScript(GetType().Assembly, "Swashbuckle.Tests.Support.testScript1.js"); c.AddOnCompleteScript(GetType().Assembly, "Swashbuckle.Tests.Support.testScript2.js"); }); _routeHandler = new SwaggerUiRouteHandler(); }
public void FixtureSetup() { SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.DocExpansion = DocExpansion.Full; c.InjectJavaScript(GetType().Assembly, "Swashbuckle.Tests.Support.testScript1.js"); c.InjectJavaScript(GetType().Assembly, "Swashbuckle.Tests.Support.testScript2.js"); c.InjectStylesheet(GetType().Assembly, "Swashbuckle.Tests.Support.testStyles1.css"); c.InjectStylesheet(GetType().Assembly, "Swashbuckle.Tests.Support.testStyles2.css"); }); _handler = new SwaggerUiHandler(); }
public void FixtureSetup() { SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.DocExpansion = DocExpansion.Full; var resourceAssembly = typeof(Dummy.SwaggerConfig).Assembly; c.InjectJavaScript(resourceAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js"); c.InjectJavaScript(resourceAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript2.js"); c.InjectStylesheet(resourceAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css"); c.InjectStylesheet(resourceAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles2.css"); }); _handler = new SwaggerUiHandler(); }
public static void Register() { Swashbuckle.Bootstrapper.Init(GlobalConfiguration.Configuration); // NOTE: If you want to customize the generated swagger or UI, use SwaggerSpecConfig and/or SwaggerUiConfig here ... SwaggerSpecConfig.Customize(c => { //c.IgnoreObsoleteActions(); c.OperationFilter <AddStandardResponseCodes>(); c.IncludeXmlComments(GetXmlCommentsPath()); }); SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.Full; c.InjectJavaScript(typeof(SwaggerConfig).Assembly, "Microbrewit.Api.Scripts.test.js"); }); }
public static void Customize() { SwaggerSpecConfig.Customize(c => { c.PostFilter(new AddErrorCodeFilter(200, "It's all good!")); c.PostFilter(new AddErrorCodeFilter(400, "Something's up!")); // uncomment this to parse documentation field when using XmlCommentDocumentationProvider //c.PostFilter(new AddXmlCommentsParsingFilter()); }); SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.Full; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.AddOnCompleteScript(typeof(SwaggerConfig).Assembly, "Swashbuckle.TestApp.swagger_ui.ext.onComplete.js"); c.AddStylesheet(typeof(SwaggerConfig).Assembly, "Swashbuckle.TestApp.swagger_ui.ext.embeddedStylesheet.css"); }); }
public static void Register(HttpConfiguration config) { Bootstrapper.Init(config); SwaggerSpecConfig.Customize(c => { c.ResolveTargetVersionUsing((req) => "2.0"); c.IgnoreObsoleteActions(); c.PolymorphicType <Product>(pc => pc .DiscriminateBy(p => p.Type) .SubType <Book>() .SubType <Album>() .SubType <Service>(sc => sc .SubType <Shipping>() .SubType <Packaging>())); c.OperationFilter <AddStandardResponseCodes>(); c.OperationFilter <AddAuthorizationResponseCodes>(); c.IncludeXmlComments(GetXmlCommentsPath()); }); SwaggerUiConfig.Customize(c => { c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.List; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.InjectJavaScript(typeof(SwaggerConfig).Assembly, "Swashbuckle.TestApp.SwaggerExtensions.customScript.js"); c.InjectStylesheet(typeof(SwaggerConfig).Assembly, "Swashbuckle.TestApp.SwaggerExtensions.customStyles.css"); // Experimenting with a custom routing feature - to override index.html and/or serve up additional content c.CustomRoute("index.html", typeof(SwaggerConfig).Assembly, "Swashbuckle.TestApp.SwaggerExtensions.index.html"); }); }
public static void Register(HttpConfiguration config) { SwaggerSpecConfig.Customize(c => { c.IgnoreObsoleteActions(); //c.SupportMultipleApiVersions( // new[] { "1.0", "2.0" }, // ResolveVersionSupportByRouteConstraint); //c.PolymorphicType<Animal>(ac => ac // .DiscriminateBy(a => a.Type) // .SubType<Kitten>()); c.OperationFilter <AddStandardResponseCodes>(); c.OperationFilter <AddAuthResponseCodes>(); c.OperationFilter <AddOAuth2Scopes>(); c.IncludeXmlComments(GetXmlCommentsPath()); c.ApiInfo(new Info { Title = "Swashbuckle Dummy", Description = "For testing and experimenting with Swashbuckle features", Contact = "*****@*****.**" }); c.Authorization("oauth2", new Authorization { Type = "oauth2", Scopes = new List <Scope> { new Scope { ScopeId = "products.read", Description = "View products" }, new Scope { ScopeId = "products.manage", Description = "Manage products" } }, GrantTypes = new GrantTypes { ImplicitGrant = new ImplicitGrant { LoginEndpoint = new LoginEndpoint { Url = "http://petstore.swagger.wordnik.com/api/oauth/dialog" }, TokenName = "access_token" } } }); c.SetRootPath("panel"); c.SetForceUseSsl(true); }); SwaggerUiConfig.Customize(c => { var thisAssembly = typeof(SwaggerConfig).Assembly; c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.List; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; c.EnableDiscoveryUrlSelector(); //c.InjectJavaScript(thisAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js"); //c.InjectStylesheet(thisAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css"); c.EnableOAuth2Support("test-client-id", "test-realm", "Swagger UI"); }); Swashbuckle.Bootstrapper.Init(config); }
public static void Register() { Swashbuckle.Bootstrapper.Init(GlobalConfiguration.Configuration); // NOTE: If you want to customize the generated swagger or UI, use SwaggerSpecConfig and/or SwaggerUiConfig here ... SwaggerSpecConfig.Customize(c => { c.IgnoreObsoleteActions(); c.ApiInfo(new Info { Title = "Welcome to SSO Architecture Reference API Interactive Documentation", Description = "Architecture Reference API is a reference for restful service which cater's services to EXTJS and AngularJS Sample application created for TCCC-19.", Contact = "*****@*****.**" }); c.IncludeXmlComments(GetXmlCommentsPath()); c.OperationFilter <AddStandardResponseCodes>(); c.OperationFilter <AddAuthResponseCodes>(); c.OperationFilter <AddOAuth2Scopes>(); c.Authorization("oauth2", new Authorization { Type = "oauth2", Scopes = new List <Scope> { new Scope { ScopeId = "default", Description = "Use this scope to perform default operations on the API" } }, GrantTypes = new GrantTypes { ImplicitGrant = new ImplicitGrant { LoginEndpoint = new LoginEndpoint { Url = Constants.AuthorizationServer.OAuth2AuthorizeEndpoint }, TokenName = "access_token" } } }); }); SwaggerUiConfig.Customize(c => { var thisAssembly = typeof(SwaggerConfig).Assembly; c.SupportHeaderParams = true; c.DocExpansion = DocExpansion.List; c.SupportedSubmitMethods = new[] { HttpMethod.Get, HttpMethod.Post, HttpMethod.Put, HttpMethod.Head }; //Inject custom Javascript and Css Style's for Swagger c.InjectJavaScript(thisAssembly, "SSOWebApi.SwaggerExtensions.SwaggerScripts.js"); c.InjectJavaScript(thisAssembly, "SSOWebApi.SwaggerExtensions.SwaggerOAuth.js"); c.InjectStylesheet(thisAssembly, "SSOWebApi.SwaggerExtensions.SwaggerStyles.css"); //Enable OAuth on the Swagger UI c.EnableOAuth2Support("implicit-SSOWebApi", "SSOWebApi", "SSOWebApi"); }); }