Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctyar/swashbuckle.yarp
A package to simplify using Swashbuckle Swagger behind YARP.
https://github.com/ctyar/swashbuckle.yarp
Last synced: 5 days ago
JSON representation
A package to simplify using Swashbuckle Swagger behind YARP.
- Host: GitHub
- URL: https://github.com/ctyar/swashbuckle.yarp
- Owner: ctyar
- License: mit
- Created: 2023-04-15T08:47:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-13T08:14:17.000Z (26 days ago)
- Last Synced: 2024-12-13T09:21:03.062Z (26 days ago)
- Language: C#
- Homepage:
- Size: 81.1 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swashbuckle Yarp
[![Build Status](https://ctyar.visualstudio.com/Swashbuckle.Yarp/_apis/build/status%2Fctyar.Swashbuckle.Yarp?branchName=main)](https://ctyar.visualstudio.com/Swashbuckle.Yarp/_build/latest?definitionId=7&branchName=main)
[![Ctyar.Swashbuckle.Yarp](https://img.shields.io/nuget/v/Ctyar.Swashbuckle.Yarp.svg)](https://www.nuget.org/packages/Ctyar.Swashbuckle.Yarp/)A package to simplify using Swashbuckle Swagger behind YARP.
## Usage
1. Add a route for each of your APIs like this:
```json
"route1": {
"ClusterId": "cluster1",
"Match": {
"Path": "/api1/{**catch-all}"
},
"Transforms": [
{
"PathRemovePrefix": "/api1"
}
]
}
```
With this configuration, calling `/api1` of your YARP will redirect to your RESTful API.2. Add `AddYarp()` with the same prefix in your RESTful API:
```csharp
app.UseSwagger(o =>
{
o.AddYarp("/api1");
});
```You can check the [samples](/src/samples) directory for a complete working example.
## Build
[Install](https://get.dot.net) the [required](global.json) .NET SDK.Run:
```
$ dotnet build
```