Skip to content

Commit

Permalink
Remove uid null warning (dotnet#2569)
Browse files Browse the repository at this point in the history
It is possible that uid is null when "uid" property is optional.
  • Loading branch information
vicancy authored Mar 30, 2018
1 parent 68f38f1 commit 947d560
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ public object Interpret(BaseSchema schema, object value, IProcessContext context
}

var uid = JsonPointer.GetChild(value, "uid") as string;
if (uid == null)
{
// schema validation threw error when uid is required, so here when uid is null, it must be optional, which is allowed
return value;
}

if (string.IsNullOrEmpty(uid))
{
Logger.LogWarning($"Invalid xrefProperties for {path}: uid is not defined.");
Logger.LogWarning($"Invalid xrefProperties for /{path}: empty uid is not allowed.");
return value;
}

Expand Down

0 comments on commit 947d560

Please sign in to comment.