The following model makes Swashbuckle throw an exception when it tries to generate the document. Please, notice that I'm decorating the properties Predicate and OrderParts with the [BindNever] attribute (they are assigned with values in an action filter) but property Predicate is causing the issues. Below the model and the exception message. Any help on this is much appreciated.
Version: v5.0.0.0
/// <summary>
/// Defines the request to get, filter, order, and paginate the vessels.
/// </summary>
public sealed class GetPageOfVesselsRequest : IPaginationRequest, IFilterRequest<Vessel>, IOrderRequest<Vessel>
{
/// <summary>
/// Defines the page id.
/// </summary>
[FromQuery(Name = GlobalRequestsNamesReference.Page)]
public int? Page { get; set; }
/// <summary>
/// Defines the page size.
/// </summary>
[FromQuery(Name = GlobalRequestsNamesReference.Size)]
public int? Size { get; set; }
/// <summary>
/// Defines the RQL filter expression.
/// </summary>
[FromQuery(Name = GlobalRequestsNamesReference.Filter)]
public string Filter { get; set; }
/// <summary>
/// Defines the predicate associated to the filter expression (if applicable).
/// </summary>
[BindNever]
public Func<Vessel, bool> Predicate { get; set; }
/// <summary>
/// Defines the RQL order expression.
/// </summary>
[FromQuery(Name = GlobalRequestsNamesReference.Order)]
public string Order { get; set; }
/// <summary>
/// Defines the order parts associated to the order expression (if applicable).
/// </summary>
[BindNever]
public IEnumerable<OrderPart> OrderParts { get; set; }
}
Exception Stacktrace:
An unhandled exception has occurred while executing the request.
System.Collections.Generic.KeyNotFoundException: The given key 'System.Reflection.TypeInfo' was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Swashbuckle.AspNetCore.SwaggerGen.PrimitiveSchemaGenerator.GenerateSchemaFor(Type type, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.ChainableSchemaGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.ArraySchemaGenerator.GenerateSchemaFor(Type type, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.ChainableSchemaGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateParameter(ApiDescription apiDescription, ApiParameterDescription apiParameter, SchemaRepository schemaRepository) at System.Linq.Enumerable.WhereSelectListIterator
2.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperation(ApiDescription apiDescription, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperations(IEnumerable
1 apiDescriptions, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GeneratePaths(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
Thanks