A better Rust ATProto crate

invalid handles refuse to decode #13

open
opened by callie.on-her.computer edited

calling into output on the awaited result of api_bsky::graph::GetFollows fails during due to one of the members of the resulting list not validating their handle.

i’m new to rust, so is there a way to catch this and still receive the parsed object for the user? i can’t find one without parsing it myself. otherwise i think .invalid should be removed from the list of disallowed tlds

yeah, definitely should handle that more elegantly. You can also use parse_data() or parse_raw_data() to get the loosely-typed data there out (note that you'll need to call .into_static() to take ownership if you need it, as those borrow), and the invalid handle would just parse as a string, but yeah that makes you still do a lot of parsing yourself.

I'm prepping the 0.8.0 release right now though, and i'll make a switch to specifically allow "handle.invalid" through, as I know this is likely common enough to be a problem (I have a few followers with invalid handles and follow a few people with them as well).

In the long-term, I'm open to ideas about how to do more elegant partial parsing to handle the general case where data is slightly ill-formed but otherwise fits a lexicon and you prefer to be permissive.

sign up or login to add to the discussion
Labels

None yet.

assignee
nonbinary.computer
Participants 2
AT URI
at://did:plc:wl4wyug27klcee5peb3xkeut/sh.tangled.repo.issue/3m3viila7dh22