internal static PropertyValues DeserializePropertyValues(JsonElement element) { Optional <JsonElement> values = default; Optional <string> name = default; Optional <PropertyTypes> type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("values")) { values = property.Value.Clone(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = new PropertyTypes(property.Value.GetString()); continue; } } return(new PropertyValues(name.Value, Optional.ToNullable(type), values)); }
internal static PropertyValues DeserializePropertyValues(JsonElement element) { Optional <IList <object> > values = default; Optional <string> name = default; Optional <PropertyTypes> type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("values")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <object> array = new List <object>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetObject()); } values = array; continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = new PropertyTypes(property.Value.GetString()); continue; } } return(new PropertyValues(name.Value, Optional.ToNullable(type), Optional.ToList(values))); }