APIs for links and references in the ATmosphere

put $type in array path

nothing is escaped, unclear how universal the $type convention is, etc.

+20 -8
+12 -3
links/src/record.rs
··· 10 } 11 } 12 JsonValue::Array(a) => { 13 - let p = format!("{path}[]"); 14 for child in a { 15 - walk_record(&p, child, found) 16 } 17 } 18 JsonValue::String(s) => { ··· 145 Link::Uri("https://youtu.be/oKXm4szEP1Q?si=_0n_uPu4qNKokMnq".into()), 146 ), 147 l( 148 - ".facets[].features[].uri", 149 Link::Uri("https://youtu.be/oKXm4szEP1Q?si=_0n_uPu4qNKokMnq".into()), 150 ), 151 ]
··· 10 } 11 } 12 JsonValue::Array(a) => { 13 for child in a { 14 + let child_p = match child { 15 + JsonValue::Object(o) => { 16 + if let Some(JsonValue::String(t)) = o.get("$type") { 17 + format!("{path}[{t}]") 18 + } else { 19 + format!("{path}[]") 20 + } 21 + } 22 + _ => format!("{path}[]"), 23 + }; 24 + walk_record(&child_p, child, found) 25 } 26 } 27 JsonValue::String(s) => { ··· 154 Link::Uri("https://youtu.be/oKXm4szEP1Q?si=_0n_uPu4qNKokMnq".into()), 155 ), 156 l( 157 + ".facets[].features[app.bsky.richtext.facet#link].uri", 158 Link::Uri("https://youtu.be/oKXm4szEP1Q?si=_0n_uPu4qNKokMnq".into()), 159 ), 160 ]