Skip to content

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

@wturrell

Description

@wturrell

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…

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions