internal static ServiceSpecification DeserializeServiceSpecification(JsonElement element) { IReadOnlyList <MetricSpecification> metricSpecifications = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metricSpecifications")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <MetricSpecification> array = new List <MetricSpecification>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(MetricSpecification.DeserializeMetricSpecification(item)); } } metricSpecifications = array; continue; } } return(new ServiceSpecification(metricSpecifications)); }
internal static ServiceSpecification DeserializeServiceSpecification(JsonElement element) { Optional <IReadOnlyList <MetricSpecification> > metricSpecifications = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metricSpecifications")) { List <MetricSpecification> array = new List <MetricSpecification>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(MetricSpecification.DeserializeMetricSpecification(item)); } metricSpecifications = array; continue; } } return(new ServiceSpecification(Optional.ToList(metricSpecifications))); }