/// <summary>Addes the Swagger generator to the OWIN pipeline.</summary> /// <param name="app">The app.</param> /// <param name="controllerTypes">The Web API controller types.</param> /// <param name="settings">The Swagger generator settings.</param> /// <returns>The app builder.</returns> public static IAppBuilder UseSwagger( this IAppBuilder app, IEnumerable <Type> controllerTypes, SwaggerOwinSettings settings) { return(app.UseSwagger(controllerTypes, settings, new SwaggerJsonSchemaGenerator(settings))); }
/// <summary>Addes the Swagger generator and Swagger UI to the OWIN pipeline.</summary> /// <param name="app">The app.</param> /// <param name="webApiAssembly">The Web API assembly to search for controller types.</param> /// <param name="settings">The Swagger generator settings.</param> /// <returns>The app builder.</returns> public static IAppBuilder UseSwagger( this IAppBuilder app, Assembly webApiAssembly, SwaggerOwinSettings settings) { return(app.UseSwagger(new[] { webApiAssembly }, settings)); }
public SwaggerMiddleware(OwinMiddleware next, string path, IEnumerable <Type> controllerTypes, SwaggerOwinSettings settings) : base(next) { _path = path; _controllerTypes = controllerTypes; _settings = settings; }
/// <summary>Initializes a new instance of the <see cref="SwaggerMiddleware"/> class.</summary> /// <param name="next">The next middleware.</param> /// <param name="path">The path.</param> /// <param name="controllerTypes">The controller types.</param> /// <param name="settings">The settings.</param> /// <param name="schemaGenerator">The schema generator.</param> public SwaggerMiddleware(OwinMiddleware next, string path, IEnumerable <Type> controllerTypes, SwaggerOwinSettings settings, SwaggerJsonSchemaGenerator schemaGenerator) : base(next) { _path = path; _controllerTypes = controllerTypes; _settings = settings; _schemaGenerator = schemaGenerator; }
/// <summary>Addes the Swagger generator and Swagger UI to the OWIN pipeline.</summary> /// <param name="app">The app.</param> /// <param name="webApiAssemblies">The Web API assemblies to search for controller types.</param> /// <param name="settings">The Swagger generator settings.</param> /// <returns>The app builder.</returns> public static IAppBuilder UseSwagger( this IAppBuilder app, IEnumerable <Assembly> webApiAssemblies, SwaggerOwinSettings settings) { var controllerTypes = webApiAssemblies.SelectMany(WebApiToSwaggerGenerator.GetControllerClasses); return(app.UseSwagger(controllerTypes, settings)); }
/// <summary>Addes the Swagger generator to the OWIN pipeline.</summary> /// <param name="app">The app.</param> /// <param name="controllerTypes">The Web API controller types.</param> /// <param name="settings">The Swagger generator settings.</param> /// <returns>The app builder.</returns> public static IAppBuilder UseSwagger( this IAppBuilder app, IEnumerable <Type> controllerTypes, SwaggerOwinSettings settings) { app.Use <SwaggerMiddleware>(settings.SwaggerRoute, controllerTypes, settings); app.UseStageMarker(PipelineStage.MapHandler); return(app); }
/// <summary>Adds the Swagger generator to the OWIN pipeline.</summary> /// <param name="app">The app.</param> /// <param name="controllerTypes">The Web API controller types.</param> /// <param name="configure">Configure the Swagger generator settings.</param> public static IAppBuilder UseSwagger( this IAppBuilder app, IEnumerable <Type> controllerTypes, Action <SwaggerOwinSettings> configure = null) { var settings = new SwaggerOwinSettings(); configure?.Invoke(settings); return(app.UseSwagger(controllerTypes, settings, new SwaggerJsonSchemaGenerator(settings))); }