Skip to content
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

Config.idFor() doesn't correctly handle multiple levels of nested anonymous structs #732

Closed
phyrwork opened this issue Aug 25, 2018 · 0 comments

Comments

@phyrwork
Copy link
Contributor

phyrwork commented Aug 25, 2018

Description

Non-nil ID detection for @id tagged structure not working correctly with nested anonymous structs with more than one level

I have identified the bug and will submit a pull request with a fix

Steps to reproduce the issue:

type struct A {
  ID quad.IRI `quad:"@id"`
}

type struct B {
  A
}

type struct C {
  B
}

v := C{}
v.ID = quad.IRI("something") // Not-nil

rules, err := c.rulesFor(rt)
...
id, err := c.idFor(rules, rt, rv, "")
// id == nil

Received results:
See description

Expected results:

id = "<something>"

Output of cayley version or commit hash:

243214c801c26d9b36436ed3d92d4ed18298b309

Environment details:
n/a

phyrwork added a commit to phyrwork/cayley that referenced this issue Aug 25, 2018
…leygraph#732)

Prefix was not being propagated in second pass so was only correct at
first level where pref == ""
phyrwork added a commit to phyrwork/cayley that referenced this issue Aug 25, 2018
…leygraph#732)

Prefix was not being propagated in second pass so was only correct at
first level where pref == ""

Add a test case to validate the fix
@dennwc dennwc closed this as completed in 1f49ada Aug 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant