![]() |
VOOZH | about |
dotnet add package Treyt.Yarp.ReverseProxy.Swagger --version 3.0.1
NuGet\Install-Package Treyt.Yarp.ReverseProxy.Swagger -Version 3.0.1
<PackageReference Include="Treyt.Yarp.ReverseProxy.Swagger" Version="3.0.1" />
<PackageVersion Include="Treyt.Yarp.ReverseProxy.Swagger" Version="3.0.1" />Directory.Packages.props
<PackageReference Include="Treyt.Yarp.ReverseProxy.Swagger" />Project file
paket add Treyt.Yarp.ReverseProxy.Swagger --version 3.0.1
#r "nuget: Treyt.Yarp.ReverseProxy.Swagger, 3.0.1"
#:package Treyt.Yarp.ReverseProxy.Swagger@3.0.1
#addin nuget:?package=Treyt.Yarp.ReverseProxy.Swagger&version=3.0.1Install as a Cake Addin
#tool nuget:?package=Treyt.Yarp.ReverseProxy.Swagger&version=3.0.1Install as a Cake Tool
👁 dotnet_main
👁 release
👁 nuget
👁 nuget_downloads
It's an easy to use Swagger extension for the YARP project.
Configure Swagger and YARP for your project.
Update appsettings.json:
{
"ReverseProxy": {
"Clusters": {
"App1Cluster": {
"Destinations": {
"Default": {
"Address": "https://localhost:5101",
"Swaggers": [ // <-- this block
{
"PrefixPath": "/proxy-app1",
"Paths": [
"/swagger/v1/swagger.json"
]
}
]
}
}
}
}
}
}
Create (if doesn't exist) or update :
public void Configure(SwaggerGenOptions options)
{
var filterDescriptors = new List<FilterDescriptor>();
foreach (var cluster in _reverseProxyDocumentFilterConfig.Clusters)
{
options.SwaggerDoc(cluster.Key, new OpenApiInfo {Title = cluster.Key, Version = cluster.Key});
}
filterDescriptors.Add(new FilterDescriptor
{
Type = typeof(ReverseProxyDocumentFilter),
Arguments = Array.Empty<object>()
});
options.DocumentFilterDescriptors = filterDescriptors;
}
Update Program.cs:
builder.Services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>();
builder.Services.AddSwaggerGen();
var configuration = builder.Configuration.GetSection("ReverseProxy");
builder.Services
.AddReverseProxy()
.LoadFromConfig(configuration)
.AddSwagger(configuration); // <-- this line
app.UseSwaggerUI(options =>
{
var config = app.Services.GetRequiredService<IOptionsMonitor<ReverseProxyDocumentFilterConfig>>().CurrentValue;
foreach (var cluster in config.Clusters)
{
options.SwaggerEndpoint($"/swagger/{cluster.Key}/swagger.json", cluster.Key);
}
});
After run you will get generated Swagger files by clusters:
Update appsettings.json:
{
"ReverseProxy": {
"Clusters": {
"App1Cluster": {
"Destinations": {
"Default": {
"Address": "https://localhost:5101",
"AccessTokenClientName": "Identity", // <-- this line
"Swaggers": [
{
"PrefixPath": "/proxy-app1",
"Paths": [
"/swagger/v1/swagger.json"
]
}
]
}
}
}
}
}
}
Update Program.cs:
builder.Services.AddAccessTokenManagement(options =>
{
var identityConfig = builder.Configuration.GetSection("Identity").Get<IdentityConfig>()!;
options.Client.Clients.Add("Identity", new ClientCredentialsTokenRequest
{
Address = $"{identityConfig.Url}/connect/token",
ClientId = identityConfig.ClientId,
ClientSecret = identityConfig.ClientSecret
});
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
Showing the top 1 popular GitHub repositories that depend on Treyt.Yarp.ReverseProxy.Swagger:
| Repository | Stars |
|---|---|
|
fdonnet/ubik_accounting
Double entry accounting app in Net 9
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1 | 24,826 | 3/28/2026 |
| 4.0.0 | 9,149 | 2/26/2026 |
| 3.9.0 | 223,227 | 12/26/2024 |
| 3.8.1 | 79,377 | 6/21/2024 |
| 3.8.0 | 33,539 | 4/3/2024 |
| 3.7.1 | 2,448 | 3/21/2024 |
| 3.6.0 | 16,835 | 1/31/2024 |
| 3.5.0 | 10,091 | 11/22/2023 |
| 3.4.0 | 998 | 11/21/2023 |
| 3.3.0 | 239,489 | 9/7/2023 |
| 3.2.2 | 792 | 9/1/2023 |
| 3.0.1 | 21,732 | 6/30/2023 |
| 2.0.3 | 561 | 6/28/2023 |