go-ipld-prime
go-ipld-prime copied to clipboard
Encoding and subsequent decoding of an ipld schema'd struct needs to work
Suppose you have a struct define as
ts.Accumulate(schema.SpawnStruct("Example", []schema.StructField{
schema.SpawnStructField("Optional", "String", true, false),
}, schema.SpawnStructRepresentationMap(map[string]string{})))
and you serialize it:
node := _Example {
Optional: _String__Maybe{v:schema.Maybe_Abscent}
}
linkPrototype.Build(ctx, ipld.LinkContext{}, node, storer)
This will serialize (with the link prototype being dagjson) to
{
"Optional": null
}
which.. is wrong?
on attempting to decode it, it will then fail.