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 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); 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 SetUp() { _swaggerSpecConfig = new SwaggerSpecConfig(); Handler = new SwaggerSpecHandler(_swaggerSpecConfig); SetUpDefaultRoutesFor(new[] { typeof(ProductsController), typeof(CustomersController) }); }
public void SetUp() { _swaggerSpecConfig = new SwaggerSpecConfig(); Handler = new SwaggerSpecHandler(_swaggerSpecConfig); SetUpDefaultRouteFor <ProductsController>(); }
public void SetUp() { var swaggerSpecConfig = new SwaggerSpecConfig(); Handler = new SwaggerSpecHandler(swaggerSpecConfig); SetUpDefaultRouteFor <FromUriParamsController>(); }
public void Setup() { SetUpDefaultRouteFor <ProductsController>(); _swaggerSpecConfig = new SwaggerSpecConfig(); _swaggerUiConfig = new SwaggerUiConfig(); Handler = new SwaggerUiHandler(_swaggerSpecConfig, _swaggerUiConfig); }
public SwaggerGenerator(SwaggerSpecConfig config) { _config = config; _operationSpecGenerator = new OperationSpecGenerator( config.CustomTypeMappings, config.SubTypesLookup, config.OperationFilters, config.OperationSpecFilters); }
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.IncludeXmlComments(GetXmlCommentsPath()); }); }
public void SetUp() { var swaggerSpecConfig = new SwaggerSpecConfig(); swaggerSpecConfig.IncludeXmlComments(String.Format(@"{0}\XmlComments.xml", AppDomain.CurrentDomain.BaseDirectory)); Handler = new SwaggerSpecHandler(swaggerSpecConfig); SetUpDefaultRouteFor <ProductsController>(); }
public static void Register() { // NOTE: Don't remove this line, it's required to wire-up the swagger routes 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.ResolveTargetVersionUsing(VersionFromApiKey); c.ResolveVersionSupportUsing(VersionSupportByAttribute); }); }
public void Setup() { // Basic config _config = new SwaggerSpecConfig() .ResolveBasePath(() => "http://tempuri.org"); // Get ApiExplorer for TestApp var httpConfiguration = new HttpConfiguration(); WebApiConfig.Register(httpConfiguration); _apiExplorer = new ApiExplorer(httpConfiguration); }
public static void Register() { Swashbuckle.Bootstrapper.Init(GlobalConfiguration.Configuration); SwaggerSpecConfig.Customize(c => { c.IncludeXmlComments(GetXmlCommentsPath()); }); //var thisAssembly = typeof(SwaggerConfig).Assembly; //GlobalConfiguration.Configuration // .EnableSwagger(c => // { // c.IncludeXmlComments(GetXmlCommentsPath()); // c.SingleApiVersion("v1", "GMfacet"); // } //).EnableSwaggerUi(c => { }); }
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 void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); //Swashbuckle の設定 Swashbuckle.Bootstrapper.Init(config); SwaggerSpecConfig.Customize(c => { var xmlPath = System.String.Format(@"{0}\SwashbuckleOwinHostSample.XML", System.AppDomain.CurrentDomain.BaseDirectory); // Self-host でない場合は HttpContext.Current.Server.MapPath("~/bin/SwashbuckleOwinHostSample.XML"); c.IncludeXmlComments(xmlPath); }); // ASP.NET Web API のルーティング設定 config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); app.UseWebApi(config); }
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 SwaggerUiHandler(SwaggerSpecConfig swaggerSpecConfig, SwaggerUiConfig config) { _swaggerSpecConfig = swaggerSpecConfig; _swaggerUiConfig = 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"); }); }
public SwaggerSpecHandler(SwaggerSpecConfig config) { _swaggerSpecConfig = config; }
public void SetUp() { _swaggerSpecConfig = new SwaggerSpecConfig(); Handler = new SwaggerSpecHandler(_swaggerSpecConfig); }
public SwaggerSpecHandler() { _config = SwaggerSpecConfig.StaticInstance; }
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); }