First of all, we have doc comments for a typedef that doesn't actually exist called "SerializedCID". The docs claim toJSON() returns this but that isn't actually true.
In our toJSON() method we return 3 properties, one of which is a Buffer and, as a result, won't be property decodable from the JSON representation.
As I started to think about what toJSON()should do I realized that the most useful thing may be returning {"/": this.baseEncodedString()}. This touches again on the discussion we're having about a canonical JSON form for links but it does seem appropriate.
I'm a little confused by the
toJSON()
method.First of all, we have doc comments for a typedef that doesn't actually exist called "SerializedCID". The docs claim
toJSON()
returns this but that isn't actually true.In our
toJSON()
method we return 3 properties, one of which is aBuffer
and, as a result, won't be property decodable from the JSON representation.As I started to think about what
toJSON()
should do I realized that the most useful thing may be returning{"/": this.baseEncodedString()}
. This touches again on the discussion we're having about a canonical JSON form for links but it does seem appropriate.