/// <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="settings">The Swagger generator settings.</param> /// <returns>The app builder.</returns> public static IApplicationBuilder UseSwagger( this IApplicationBuilder app, IEnumerable <Type> controllerTypes, SwaggerSettings settings) { return(app.UseSwagger(controllerTypes, settings, new SwaggerJsonSchemaGenerator(settings))); }
/// <summary>Adds 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 IApplicationBuilder UseSwagger( this IApplicationBuilder app, Assembly webApiAssembly, SwaggerSettings settings) { return(app.UseSwagger(new[] { webApiAssembly }, settings)); }
/// <summary>Initializes a new instance of the <see cref="SwaggerMiddleware"/> class.</summary> /// <param name="nextDelegate">The next delegate.</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(RequestDelegate nextDelegate, string path, IEnumerable <Type> controllerTypes, SwaggerSettings settings, SwaggerJsonSchemaGenerator schemaGenerator) { _nextDelegate = nextDelegate; _path = path; _controllerTypes = controllerTypes; _settings = settings; _schemaGenerator = schemaGenerator; }
/// <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="settings">The Swagger generator settings.</param> /// <param name="schemaGenerator">The schema generator.</param> /// <returns>The app builder.</returns> public static IApplicationBuilder UseSwagger( this IApplicationBuilder app, IEnumerable <Type> controllerTypes, SwaggerSettings settings, SwaggerJsonSchemaGenerator schemaGenerator) { app.UseMiddleware <SwaggerMiddleware>(settings.ActualSwaggerRoute, controllerTypes, settings, schemaGenerator); return(app); }
/// <summary>Adds 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 IApplicationBuilder UseSwagger( this IApplicationBuilder app, IEnumerable <Assembly> webApiAssemblies, SwaggerSettings settings) { var controllerTypes = webApiAssemblies.SelectMany(WebApiToSwaggerGenerator.GetControllerClasses); return(app.UseSwagger(controllerTypes, settings)); }
/// <summary>Adds the Swagger generator that uses Api Description to perform Swagger generation.</summary> /// <param name="app">The app.</param> /// <param name="configure">Configure the Swagger settings.</param> /// <param name="schemaGenerator">The schema generator.</param> public static IApplicationBuilder UseSwaggerWithApiExplorer( this IApplicationBuilder app, Action <SwaggerSettings <AspNetCoreToSwaggerGeneratorSettings> > configure = null, SwaggerJsonSchemaGenerator schemaGenerator = null) { var settings = new SwaggerSettings <AspNetCoreToSwaggerGeneratorSettings>(); configure?.Invoke(settings); return(app.UseMiddleware <AspNetCoreToSwaggerMiddleware>(settings, schemaGenerator ?? new SwaggerJsonSchemaGenerator(settings.GeneratorSettings))); }
/// <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 IApplicationBuilder UseSwagger( this IApplicationBuilder app, IEnumerable <Type> controllerTypes, Action <SwaggerSettings> configure = null) { var settings = new SwaggerSettings(); configure?.Invoke(settings); return(app.UseSwagger(controllerTypes, settings, new SwaggerJsonSchemaGenerator(settings))); }
/// <summary>Adds the Swagger generator to the pipeline.</summary> /// <param name="app">The app.</param> /// <param name="controllerTypes">The Web API controller types.</param> /// <param name="configure">Configure the Swagger settings.</param> /// <param name="schemaGenerator">The schema generator.</param> /// <returns>The app builder.</returns> public static IApplicationBuilder UseSwagger( this IApplicationBuilder app, IEnumerable <Type> controllerTypes, Action <SwaggerSettings <WebApiToSwaggerGeneratorSettings> > configure = null, SwaggerJsonSchemaGenerator schemaGenerator = null) { var settings = new SwaggerSettings <WebApiToSwaggerGeneratorSettings>(); configure?.Invoke(settings); app.UseMiddleware <WebApiToSwaggerMiddleware>(settings.ActualSwaggerRoute, controllerTypes, settings, schemaGenerator ?? new SwaggerJsonSchemaGenerator(settings.GeneratorSettings)); return(app); }