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

Nesting (e.g. Review inside Book, ratings inside reviews etc.) #69

Open
wturrell opened this issue May 3, 2021 · 0 comments
Open

Nesting (e.g. Review inside Book, ratings inside reviews etc.) #69

wturrell opened this issue May 3, 2021 · 0 comments

Comments

@wturrell
Copy link

wturrell commented May 3, 2021

Is passing one jsonld ContextType into another officially supported?
I assumed it would be, but none of the examples show it and I'm having loads of problems.

I've tried a couple of ways - e.g.

  • just nesting another call to \JsonLd\Context::create(Foo, $data) inside the main array
  • creating an entirely new instance with new \JsonLd\ContextTypes\Person()

Typically, the end output will either have an empty array where the nested context should be, or what looks like raw object data: i.e. only the @type defined and a "properties" array of everything, regardless of whether a value has been supplied - so mostly a long, empty list.

I've also come across situations where the second object works, but it fails on adding a third level (you may need to nest a Person (the reviewer) inside a Review inside a Book, for example).

Thanks in advance…

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