last ...
This commit is contained in:
@@ -45,11 +45,13 @@ namespace xCommons.Extensions {
|
||||
/// <param name="xmlFilePath"></param>
|
||||
/// <param name="addRequiredXPoweredFilter"></param>
|
||||
/// <param name="addXTokenAuthorization"></param>
|
||||
/// <param name="addDefaultValueFilter"></param>
|
||||
public static void AddXSwaggerGenOptions (
|
||||
this SwaggerGenOptions source,
|
||||
string xmlFilePath = null,
|
||||
bool addRequiredXPoweredFilter = true,
|
||||
bool addXTokenAuthorization = true
|
||||
bool addXTokenAuthorization = true,
|
||||
bool addDefaultValueFilter = true
|
||||
) {
|
||||
//
|
||||
if (source.IsNull ()) {
|
||||
@@ -68,6 +70,12 @@ namespace xCommons.Extensions {
|
||||
source.OperationFilter<RequireXPoweredOperationFilter> ();
|
||||
}
|
||||
|
||||
//
|
||||
// Add Default Values Filter ...
|
||||
if (addDefaultValueFilter) {
|
||||
source.OperationFilter<SwaggerDefaultValuesOperationFilter> ();
|
||||
}
|
||||
|
||||
//
|
||||
// Handle XToken Authorizations ...
|
||||
if (addXTokenAuthorization) {
|
||||
@@ -151,13 +159,15 @@ namespace xCommons.Extensions {
|
||||
/// <param name="xmlFilePath"></param>
|
||||
/// <param name="addRequiredXPoweredFilter"></param>
|
||||
/// <param name="addXTokenAuthorization"></param>
|
||||
/// <param name="addDefaultValueFilter"></param>
|
||||
public static void AddXSwagger (
|
||||
this IServiceCollection source,
|
||||
IConfiguration configuration,
|
||||
SwaggerGenOptions settings = null,
|
||||
string xmlFilePath = null,
|
||||
bool addRequiredXPoweredFilter = true,
|
||||
bool addXTokenAuthorization = true
|
||||
bool addXTokenAuthorization = true,
|
||||
bool addDefaultValueFilter = true
|
||||
) {
|
||||
//
|
||||
var xSwaggerConfig = configuration.GetXSwaggerConfiguration ();
|
||||
@@ -165,6 +175,9 @@ namespace xCommons.Extensions {
|
||||
xSwaggerConfig = new XSwaggerConfiguration ();
|
||||
}
|
||||
|
||||
//
|
||||
source.AddSingleton(xSwaggerConfig);
|
||||
|
||||
//
|
||||
#region Prepare SwaggerGenOptions ...
|
||||
if (settings.IsNull ()) {
|
||||
@@ -172,8 +185,9 @@ namespace xCommons.Extensions {
|
||||
}
|
||||
settings.AddXSwaggerGenOptions (
|
||||
xmlFilePath: xmlFilePath,
|
||||
addRequiredXPoweredFilter: addRequiredXPoweredFilter,
|
||||
addXTokenAuthorization: addXTokenAuthorization
|
||||
addDefaultValueFilter: addDefaultValueFilter,
|
||||
addXTokenAuthorization: addXTokenAuthorization,
|
||||
addRequiredXPoweredFilter: addRequiredXPoweredFilter
|
||||
);
|
||||
#endregion
|
||||
|
||||
@@ -242,6 +256,9 @@ namespace xCommons.Extensions {
|
||||
opt.SwaggerDoc ("v1", apiDoc);
|
||||
}
|
||||
);
|
||||
|
||||
//
|
||||
// Register Swagger Operation Filters ...
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user