Initial Commit ...
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using xApi.Constants;
|
||||
using Microsoft.OpenApi.Any;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace xApi.Attributes
|
||||
{
|
||||
public class SwaggerDefaultValues : IOperationFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply Default Values ...
|
||||
/// </summary>
|
||||
/// <param name="operation"></param>
|
||||
/// <param name="context"></param>
|
||||
public void Apply(
|
||||
OpenApiOperation operation,
|
||||
OperationFilterContext context
|
||||
)
|
||||
{
|
||||
//
|
||||
// Detect Version Parameter ...
|
||||
var versionParam = operation.Parameters
|
||||
.FirstOrDefault(p => p.Name == Params.ApiVersionParam);
|
||||
if (versionParam is not null)
|
||||
{
|
||||
versionParam.Schema.Default = new OpenApiString("1.0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user