Releases: luoyunchong/IGeekFan.AspNetCore.RapiDoc
Releases · luoyunchong/IGeekFan.AspNetCore.RapiDoc
IGeekFan.AspNetCore.RapiDoc.Extra Badges
v0.0.5
IGeekFan.AspNetCore.RapiDoc.Extra
There is only one class,Display labels on methods through 'filter'
CLI
dotnet add package IGeekFan.AspNetCore.RapiDoc.Extra
in AddSwaggerGen services add RapiDocLableOperationFilter
Filter、
Your need add this namespaceIGeekFan.AspNetCore.RapiDoc.Extra
builder.Services.AddSwaggerGen(c =>
{
+ c.OperationFilter<RapiDocLableOperationFilter>();
var filePath = Path.Combine(System.AppContext.BaseDirectory, $"{typeof(Program).Assembly.GetName().Name}.xml");
c.IncludeXmlComments(filePath, true);
c.SwaggerDoc("v1", new OpenApiInfo { Title = "AspNetCore6_RapiDemo", Version = "v1" });
});
In Your Controller,You can add this attribute to the method
+ [RapiDocLabel("Core Api")]
+ [RapiDocLabel("Test",RapiDocColor.RED)]
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return null;
}
Views
- In appsettings.json
builder.Services.Configure<RapiDocOptions>(c =>{
builder.Configuration.Bind("RapiDoc", c);
});
aoosettings.json
"RapiDoc": {
"RoutePrefix": "swagger",
"DocumentTitle": "ASPNET CORE 6 RAPI DOC",
"GenericRapiConfig": {
"Theme": "dark"
}
}
Use Middleware Config Higher priority, All GenericRapiConfig can configuration in you appsettings.json,Please refer to this documents https://mrin9.github.io/RapiDoc/api.html
app.UseRapiDocUI(c =>
{
//This Config Higher priority
c.GenericRapiConfig = new GenericRapiConfig()
{
RenderStyle= "read",//read | view | focused
Theme="light",//light | dark
SchemaStyle= "table"//tree | table
};
});