Skip to content

feat(jsonld): operations as schema.org actions - #8877

Draft
dunglas wants to merge 1 commit into
mainfrom
feat/jsonld-potential-action
Draft

dunglas wants to merge 1 commit into
mainfrom
feat/jsonld-potential-action

Conversation

@dunglas

@dunglas dunglas commented Nov 26, 2026

Copy link
Copy Markdown
Member
Q A
Branch? main
Tickets
License MIT
Doc PR api-platform/docs#...

Adds schema.org potential actions. Operations flagged with extraProperties: ['potential_action' => true] are listed under potentialAction in the JSON-LD representation of their resource: on the item when the operation has URI variables, on the collection otherwise.

#[Post(
    uriTemplate: '/actionable_books/{id}/archive',
    input: ArchiveBookInput::class,
    hydraContext: ['@type' => 'schema:ArchiveAction'],
    extraProperties: ['potential_action' => true],
)]

Each action carries an EntryPoint (urlTemplate, httpMethod, encodingType, contentType) and a <property>-input: required annotation per required writable property. The action type comes from, in order: one action per mapping key for a @type discriminated input, the operation's hydra @type, or a default derived from the HTTP method (CreateAction, ReplaceAction, UpdateAction, DeleteAction). The resource context scopes potentialAction to the schema.org vocabulary.

Test: tests/Functional/JsonLd/PotentialActionTest.php

Operations flagged with extraProperties: ['potential_action' => true] are
listed under potentialAction in the JSON-LD representation of the GET item
(operations with URI variables) or collection (operations without) they
belong to. An @type discriminated input yields one action per mapping key;
other operations use their hydra @type or a default derived from the HTTP
method. Required input properties are annotated with <property>-input.

The resource context scopes potentialAction to the schema.org vocabulary.
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