-
Notifications
You must be signed in to change notification settings - Fork 47
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
Should the JSON represenetation of CID always be formatted as links. #76
Comments
Really, this is the correct format for We did the In practice, this allows us to write: type Person struct {
name string
friends map[string]cid.Cid
} And have |
@Stebalien that may be true, but now that we can put strings in maps how will |
It won't. That's not valid DagJSON. It could serialize to CBOR (in theory) but we currently restrict map keys to be strings (IIRC, this is a hold-over from the days when we wanted all map keys to be valid path components). |
This comment has been minimized.
This comment has been minimized.
So after testing and a little more research it seams |
I was going to open an issue to discuss that Note how this requires that every language implements additional json handling for CIDs just because it does not come as a simple string that can be thrown to Would having a global switch (variable) that just outputs them as a string be an option? It's a bad solution, but I can't think of anything non-breaking and would help cluster keep API compatibility if we let Cids marshal themselves to JSON in the future. |
My understanding is that the idea behind
{"/": <cid-string>}
is when Cid are represented as links. Should they always be serialized like this. In many cases a Cid acts more as an identifier than a link.I see it just adding additional overhead to the JSON stream, espacally when returning a list of CIDs
Also it seams that even the idea of encoding them this was in conversational, at least based on @Stebalien comments in ipld/specs#70 when he said:
and
The text was updated successfully, but these errors were encountered: