Skip to content

Commit

Permalink
Relaxed JSON serializer for path elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed May 13, 2020
1 parent f8457c0 commit 8cb4b4b
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,17 @@ private static void WritePath(Utf8JsonWriter writer, IReadOnlyList<object> path)
writer.WriteNumberValue(n);
break;

case short n:
writer.WriteNumberValue(n);
break;

case long n:
writer.WriteNumberValue(n);
break;

default:
throw new InvalidOperationException(
"The specified value is of an invalid type " +
"for the error path.");
writer.WriteStringValue(path[i].ToString());
break;
}
}

Expand Down

0 comments on commit 8cb4b4b

Please sign in to comment.