/// <summary> /// Enables integration of ServiceModel.Grpc with Swashbuckle.AspNetCore. /// </summary> /// <param name="services">The <see cref="IServiceCollection"/>.</param> /// <param name="configure">The optional configuration action.</param> /// <returns>The the same <see cref="IServiceCollection"/>.</returns> public static IServiceCollection AddServiceModelGrpcSwagger( this IServiceCollection services, Action <ServiceModelGrpcSwaggerOptions>?configure = default) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (configure != null) { services.Configure(configure); } ServiceCollectionExtensions.AddSwagger(services, ResolveDataSerializer); services.ConfigureSwaggerGen(ConfigureSwagger); return(services); }
/// <summary> /// Enables integration of ServiceModel.Grpc with NSwag. /// </summary> /// <param name="services">The <see cref="IServiceCollection"/>.</param> /// <param name="configure">The optional configuration action.</param> /// <returns>The the same <see cref="IServiceCollection"/>.</returns> public static IServiceCollection AddServiceModelGrpcSwagger( this IServiceCollection services, Action <ServiceModelGrpcSwaggerOptions>?configure = default) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (configure != null) { services.Configure(configure); } ServiceCollectionExtensions.AddSwagger(services, ResolveDataSerializer); services.TryAddEnumerable(ServiceDescriptor.Transient <IOperationProcessor, SwaggerOperationProcessor>()); return(services); }