Skip to content

Commit

Permalink
Merge pull request #4 from OlegShatin/patch-1
Browse files Browse the repository at this point in the history
NRE for FromQuery fixed
  • Loading branch information
unchase authored Dec 26, 2019
2 parents 5a9fd7d + 7b1865a commit 4cc2107
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public class XEnumNamesParameterFilter : IParameterFilter
{
public void Apply(IParameter parameter, ParameterFilterContext context)
{
var typeInfo = context.ParameterInfo.ParameterType;
var typeInfo = context.ParameterInfo?.ParameterType?? context.PropertyInfo.PropertyType;
if (typeInfo.IsEnum)
{
var names = Enum.GetNames(context.ParameterInfo.ParameterType);
var names = Enum.GetNames(typeInfo);
parameter.Extensions.Add("x-enumNames", names);
}
else if (typeInfo.IsGenericType && !parameter.Extensions.ContainsKey("x-enumNames"))
Expand Down

0 comments on commit 4cc2107

Please sign in to comment.