Skip to content

Commit

Permalink
Made GoogleType selection a bit better
Browse files Browse the repository at this point in the history
  • Loading branch information
i8beef committed Jan 4, 2021
1 parent 37cddd2 commit 7ee24af
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/HomeAutio.Mqtt.GoogleHome/Extensions/JsonSchemaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ public static GoogleType GetGoogleTypeForFlattenedPath(this NJsonSchema.JsonSche
return GoogleType.Unknown;
}

switch (foundSchemas[0].Type)
foreach (var foundSchema in foundSchemas)
{
case NJsonSchema.JsonObjectType.Integer:
case NJsonSchema.JsonObjectType.Number:
return GoogleType.Numeric;
case NJsonSchema.JsonObjectType.Boolean:
return GoogleType.Bool;
case NJsonSchema.JsonObjectType.String:
return GoogleType.String;
switch (foundSchema.Type)
{
case NJsonSchema.JsonObjectType.Integer:
case NJsonSchema.JsonObjectType.Number:
return GoogleType.Numeric;
case NJsonSchema.JsonObjectType.Boolean:
return GoogleType.Bool;
case NJsonSchema.JsonObjectType.String:
return GoogleType.String;
}
}

return GoogleType.Unknown;
Expand Down

0 comments on commit 7ee24af

Please sign in to comment.