-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat(bindnode): support listpairs struct representation #514
Conversation
node/bindnode/repr.go
Outdated
w.nextIndex++ | ||
if idx%2 == 0 { | ||
asm := (*_structAssembler)(w).AssembleKey() | ||
// ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this meant to have a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, embarrassing ... that's there cause I don't actually know why I would want to put the next line there; I intended to figure this out
marked as draft cause I just realised after writing out the example above that listpairs is actually |
1d56cfb
to
9f16030
Compare
OK, fixed, this now handles I also extended the test a bit more so we're not just setting strings as values but also adding a recursive kind on one of the fields, so we end up doing a |
9f16030
to
9f519f1
Compare
aacd362
to
5f65ed8
Compare
Made the parser handle "listpairs" for structs in the DSL, including enabling the test fixture that's been waiting to be implemented: ipld/ipld#281 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
current impl works on scalar assemblies but borks when you try to assemble a child that has a non-scalar; so nested listpairs in listpairs doesn't work because we've not been passing representation assemblers properly
95a91b0
to
e3ab704
Compare
good thing I held off until I had a chance to properly try and use this, it borked on complex nested values—trying to do a listpairs within a listpairs errored out; very tricky to get the "level" right with these builders, representation builders use the schema builders but always need to force them to drop back down to representation level when returning sub-builders to the user hopefully fixed now, still trying to put it to use |
I want order-preserving structs without a pre-defined strict order (tuple), so this implements listpairs which is in the schema spec but has sparse support through go-ipld-prime.
(edit: actually should be this:)
But also this should decode to the same struct (see
out-of-order
test):(edit: actually should be this:)