Skip to content

feat(jsonld)!: a view has the type of its resource - #8941

Open
soyuka wants to merge 2 commits into
output-resource/2-collectfrom
output-resource/3-view
Open

soyuka wants to merge 2 commits into
output-resource/2-collectfrom
output-resource/3-view

Conversation

@soyuka

@soyuka soyuka commented Dec 3, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main (6.0, merge after v5.1.0)
Tickets Refs #8849
License MIT
Doc PR api-platform/docs#2321 (to rewrite once the stack lands)

Part 3/6 of the RFC #8849 stack (https://github.com/api-platform/core/stack/8945), review commit by commit: the first commit is the failing test.

An operation with an output and an item template (itemUriTemplate, else canonicalUriTemplate from #8479) is a view: the output gets the item @id and the resource @type (JSON-LD) / type (JSON:API). Hydra documents the view properties on the resource and does not list the view class; an output without item template is "another thing", keeps its own type and is what returns points to. JSON Schema names are unchanged. The types: [...] workaround in BookStoreResource is gone.

Test: tests/Functional/JsonLd/ViewOutputTest.php.

BC: an inherited resource-level canonicalUriTemplate turns every output operation into a view, set canonicalUriTemplate: null on an operation whose output is another thing.

An operation declaring an output and an item template (itemUriTemplate
or canonicalUriTemplate) serves a view of the item: it gets the item IRI
and the resource type in JSON-LD and JSON:API, Hydra documents its
properties on the resource and does not list the view as a class. An
output without item template keeps its own type and is what returns
points to.

Refs #8849
@soyuka
soyuka added this pull request to stack #8945 December 3, 2026 15:14
@soyuka soyuka changed the title output resource/3 view feat(jsonld)!: a view has the type of its resource Dec 3, 2026
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

Successfully merging this pull request may close these issues.

1 participant