internal static ResourceLink DeserializeResourceLink(JsonElement element) { Optional <string> id = default; Optional <string> name = default; Optional <object> type = default; Optional <ResourceLinkProperties> properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetObject(); continue; } if (property.NameEquals("properties")) { properties = ResourceLinkProperties.DeserializeResourceLinkProperties(property.Value); continue; } } return(new ResourceLink(id.Value, name.Value, type.Value, properties.Value)); }
internal static ResourceLink DeserializeResourceLink(JsonElement element) { string id = default; string name = default; object type = default; ResourceLinkProperties properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetObject(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } properties = ResourceLinkProperties.DeserializeResourceLinkProperties(property.Value); continue; } } return(new ResourceLink(id, name, type, properties)); }