-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some of my posts don't decode #142
Comments
(I haven't looked into what the panic is; just filing before I forget.) |
I will need to look, but off the top of my head:
|
Removing the recover, here's one of the panic stacks:
|
oh yeah, this is a bug in the refmt library, it doesnt properly convert certain things. Need to just swap that out i think |
I think this might be a generic problem with any CBOR to JSON conversion. For instance, CBOR allows for non-string keys in its maps and JSON libraries typically don't (because the JSON spec says not to). The panic in remft might be caused by that. As evidence, I did a quick conversion from I believe there's a few options available:
|
FWIW, I'm in the middle of writing up better public specs for our data model (use of JSON and CBOR) and the Lexicon schema definition library. Those should end up in review over at https://github.com/bluesky-social/atproto-website/pulls in the next couple days, and might help nail down the space of data objects that need to be handled (or not). |
Hi @jmhodges, not sure if it can be used here, but the Instead of decoder returning "map[interface {}]interface {}", it will return "map[string]interface {}" like this: b, _ := hex.DecodeString("a161616141") // {"a": "A"}
// Decoding option to allow user to specify custom default map type.
dm, _ := cbor.DecOptions{
DefaultMapType: reflect.TypeOf(map[string]interface{}(nil)),
}.DecMode()
var v interface{}
_ = dm.Unmarshal(b, &v)
fmt.Printf("decoded: %v (%T)\n", v, v)
// decoded: map[a:A] (map[string]interface {}) https://go.dev/play/p/_og5ySCtqYN
BTW, it isn't exactly pretty printing, but recently Hope this info is useful. FWIW, I found CDDL and EDN to be incredibly helpful in defining CBOR-based data format and creating a codec for it. |
Well! The I'm not sure if there's other types where this would fail because I'm less familiar with the lexicon than the others in this thread. Seems like a plausible short term solution with a plausible long term follow-up of upgrading to cbor v2.5.0 when it's out. |
gosky list --all
works on most of my repo, but some values don't parse:/cc @whyrusleeping @bnewbold
The text was updated successfully, but these errors were encountered: