Just updated all the things and had to fix a bunch of stuff to get rid of the compiler errors, haven't run anything yet, just got it to compile at this point.
This commit is contained in:
@@ -1,47 +1,47 @@
|
||||
namespace AyaNova
|
||||
{
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using System.Linq;
|
||||
// namespace AyaNova
|
||||
// {
|
||||
// using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
// using System.Linq;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the Swagger/Swashbuckle operation filter used to document the implicit API version parameter.
|
||||
/// </summary>
|
||||
/// <remarks>This <see cref="IOperationFilter"/> is only required due to bugs in the <see cref="SwaggerGenerator"/>.
|
||||
/// Once they are fixed and published, this class can be removed.</remarks>
|
||||
public class SwaggerDefaultValues : IOperationFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies the filter to the specified operation using the given context.
|
||||
/// </summary>
|
||||
/// <param name="operation">The operation to apply the filter to.</param>
|
||||
/// <param name="context">The current operation filter context.</param>
|
||||
public void Apply( Operation operation, OperationFilterContext context )
|
||||
{
|
||||
// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/412
|
||||
// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/pull/413
|
||||
foreach ( var parameter in operation.Parameters.OfType<NonBodyParameter>() )
|
||||
{
|
||||
var description = context.ApiDescription.ParameterDescriptions.First( p => p.Name == parameter.Name );
|
||||
var routeInfo = description.RouteInfo;
|
||||
|
||||
if ( parameter.Description == null )
|
||||
{
|
||||
parameter.Description = description.ModelMetadata?.Description;
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Represents the Swagger/Swashbuckle operation filter used to document the implicit API version parameter.
|
||||
// /// </summary>
|
||||
// /// <remarks>This <see cref="IOperationFilter"/> is only required due to bugs in the <see cref="SwaggerGenerator"/>.
|
||||
// /// Once they are fixed and published, this class can be removed.</remarks>
|
||||
// public class SwaggerDefaultValues : IOperationFilter
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// Applies the filter to the specified operation using the given context.
|
||||
// /// </summary>
|
||||
// /// <param name="operation">The operation to apply the filter to.</param>
|
||||
// /// <param name="context">The current operation filter context.</param>
|
||||
// public void Apply( Operation operation, OperationFilterContext context )
|
||||
// {
|
||||
// // REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/412
|
||||
// // REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/pull/413
|
||||
// foreach ( var parameter in operation.Parameters.OfType<NonBodyParameter>() )
|
||||
// {
|
||||
// var description = context.ApiDescription.ParameterDescriptions.First( p => p.Name == parameter.Name );
|
||||
// var routeInfo = description.RouteInfo;
|
||||
|
||||
if ( routeInfo == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// if ( parameter.Description == null )
|
||||
// {
|
||||
// parameter.Description = description.ModelMetadata?.Description;
|
||||
// }
|
||||
|
||||
if ( parameter.Default == null )
|
||||
{
|
||||
parameter.Default = routeInfo.DefaultValue;
|
||||
}
|
||||
// if ( routeInfo == null )
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
parameter.Required |= !routeInfo.IsOptional;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if ( parameter.Default == null )
|
||||
// {
|
||||
// parameter.Default = routeInfo.DefaultValue;
|
||||
// }
|
||||
|
||||
// parameter.Required |= !routeInfo.IsOptional;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user