Closed vmx closed 4 years ago
Oh, dang. I don't know if I remember seeing that commit the first time it went by. That's cool.
Yeah, we should totally reify that and post the schema in the specs repo.
The protobuf schema in block-layer/codecs/dag-pb.md is already pretty close to what it'd be in IPLD Schema. This is basically it, right?
type PBLink struct {
Hash optional Bytes
Name optional String
Tsize optional Int
}
type PBNode struct {
Links [PBLink]
Data Bytes
}
The capitalisation is pretty annoying, would it be better with renames though?
type PBLink struct {
hash optional Bytes (rename "Hash")
name optional String (rename "Name")
tsize optional Int (rename "Tsize")
}
type PBNode struct {
links [PBLink] (rename "Links")
data Bytes (rename "Data")
}
And is that specificity even necessary since protobuf won't care about the names in the same way.
put it in #247 for further refinement
DagPB doesn't support the full IPLD Data Model, nonetheless it can be serialized into the IPLD Data Model. Hence it would be great to have an IPLD Schema for it. Such a Schema already exists in code at https://github.com/ipld/go-ipld-prime-proto/blob/e32bd156a1e52653dbdb8b1696d74205a20f220c/gen/main.go and could be translated into the schema syntax.