Skip to content

Commit

Permalink
chore: remove indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
HunorTotBagi committed Jan 30, 2025
1 parent 02dde04 commit 2e2b21a
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ public override ReminderId Read(ref Utf8JsonReader reader, Type typeToConvert, J
switch (reader.TokenType)
{
case JsonTokenType.String:
{
var guidString = reader.GetString();
if (!Guid.TryParse(guidString, out var guid))
throw new JsonException($"Invalid GUID format for ReminderId: {guidString}");
{
var guidString = reader.GetString();
if (!Guid.TryParse(guidString, out var guid))
throw new JsonException($"Invalid GUID format for ReminderId: {guidString}");

return ReminderId.Of(guid);
}
case JsonTokenType.StartObject:
{
using var jsonDoc = JsonDocument.ParseValue(ref reader);
return ReminderId.Of(guid);
}
case JsonTokenType.StartObject:
{
using var jsonDoc = JsonDocument.ParseValue(ref reader);

if (!jsonDoc.RootElement.TryGetProperty("id", out JsonElement idElement))
throw new JsonException("Expected property 'id' not found.");
if (!jsonDoc.RootElement.TryGetProperty("id", out JsonElement idElement))
throw new JsonException("Expected property 'id' not found.");

var guidString = idElement.GetString();
var guidString = idElement.GetString();

if (!Guid.TryParse(guidString, out var guid))
throw new JsonException($"Invalid GUID format for ReminderId: {guidString}");
if (!Guid.TryParse(guidString, out var guid))
throw new JsonException($"Invalid GUID format for ReminderId: {guidString}");

return ReminderId.Of(guid);
}
return ReminderId.Of(guid);
}
default:
throw new JsonException(
$"Unexpected token parsing ReminderId. Expected String or StartObject, got {reader.TokenType}.");
Expand Down

0 comments on commit 2e2b21a

Please sign in to comment.