Skip to content

Commit

Permalink
Merge pull request #28 from LykkeCity/bugfix-required-properties
Browse files Browse the repository at this point in the history
bug fixed
  • Loading branch information
tarurar committed Nov 16, 2018
2 parents 4eb1366 + 9346152 commit a56852c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Apply(Schema schema, SchemaFilterContext context)
return;
}

var nonNulableValueTypedPropNames = context.SystemType.GetProperties()
var nonNullableValueTypedPropNames = context.SystemType.GetProperties()
.Where(p =>
// is it value type?
p.PropertyType.GetTypeInfo().IsValueType &&
Expand All @@ -30,9 +30,9 @@ public void Apply(Schema schema, SchemaFilterContext context)
p.CanRead && p.CanWrite)
.Select(p => p.Name);

schema.Required = schema.Properties.Keys
.Union(nonNulableValueTypedPropNames, StringComparer.OrdinalIgnoreCase)
.ToList();
schema.Required = schema.Required == null
? nonNullableValueTypedPropNames.ToList()
: schema.Required.Union(nonNullableValueTypedPropNames, StringComparer.OrdinalIgnoreCase).ToList();

if (!schema.Required.Any())
{
Expand Down

0 comments on commit a56852c

Please sign in to comment.