internal static Models DeserializeModels(JsonElement element) { Optional <ModelsSummary> summary = default; Optional <IReadOnlyList <CustomFormModelInfo> > modelList = default; Optional <string> nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("summary")) { summary = ModelsSummary.DeserializeModelsSummary(property.Value); continue; } if (property.NameEquals("modelList")) { List <CustomFormModelInfo> array = new List <CustomFormModelInfo>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(CustomFormModelInfo.DeserializeCustomFormModelInfo(item)); } modelList = array; continue; } if (property.NameEquals("nextLink")) { nextLink = property.Value.GetString(); continue; } } return(new Models(summary.Value, Optional.ToList(modelList), nextLink.Value)); }
internal static Models DeserializeModels(JsonElement element) { ModelsSummary summary = default; IReadOnlyList <ModelInfo> modelList = default; string nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("summary")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } summary = ModelsSummary.DeserializeModelsSummary(property.Value); continue; } if (property.NameEquals("modelList")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <ModelInfo> array = new List <ModelInfo>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(ModelInfo.DeserializeModelInfo(item)); } } modelList = array; continue; } if (property.NameEquals("nextLink")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } nextLink = property.Value.GetString(); continue; } } return(new Models(summary, modelList, nextLink)); }