Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Describe DagPB also as IPLD Schema #245

Closed
vmx opened this issue Mar 9, 2020 · 3 comments · Fixed by #247
Closed

Describe DagPB also as IPLD Schema #245

vmx opened this issue Mar 9, 2020 · 3 comments · Fixed by #247

Comments

@vmx
Copy link
Member

vmx commented Mar 9, 2020

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.

@warpfork
Copy link
Contributor

warpfork commented Mar 9, 2020

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.

@rvagg
Copy link
Member

rvagg commented Mar 10, 2020

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.

rvagg added a commit that referenced this issue Mar 10, 2020
@rvagg
Copy link
Member

rvagg commented Mar 10, 2020

put it in #247 for further refinement

vmx pushed a commit that referenced this issue May 26, 2020
rvagg added a commit that referenced this issue May 27, 2020
rvagg added a commit that referenced this issue May 27, 2020
rvagg added a commit that referenced this issue May 27, 2020
prataprc pushed a commit to iprs-dev/ipld-specs that referenced this issue Oct 13, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants