public static IApplicationBuilder UseJsonRpcWithSwaggerUI(this IApplicationBuilder app, Action <RpcEndpointBuilder>?configureRpc = null, Action <SwaggerOptions>?configureSwagger = null, Action <SwaggerUIOptions>?configureSwaggerUI = null) { return(app .UseSwagger(configureSwagger) .UseSwaggerUI(configureSwaggerUI ?? StartupExtensions.GetDefaultSwaggerUIOptions()) .UseJsonRpc(configureRpc)); }
public static IServiceCollection AddJsonRpcWithSwagger(this IServiceCollection services, Action <RpcServerConfiguration>?configureRpc = null, JsonSerializerOptions?jsonSerializerOptions = null, Action <SwaggerGenOptions>?configureSwaggerGen = null) { configureSwaggerGen = configureSwaggerGen ?? StartupExtensions.GetDefaultSwaggerGenOptions(); jsonSerializerOptions = jsonSerializerOptions ?? new JsonSerializerOptions(); services.TryAddSingleton <ISerializerDataContractResolver>(s => { return(new JsonSerializerDataContractResolver(jsonSerializerOptions)); }); return(services //enable xml documentation generation in project options (release and debug) .AddSingleton <IXmlDocumentationService, XmlDocumentationService>() .AddSingleton <ISwaggerProvider, JsonRpcSwaggerProvider>() .AddSwaggerGen(configureSwaggerGen) .AddJsonRpc(configureRpc)); }