Skip to content

fix(jsonapi): document non-exposed relations in included schema - #8734

Merged
soyuka merged 1 commit into
api-platform:5.0from
soyuka:fix/jsonapi-included-notexposed-8700
Oct 19, 2026
Merged

soyuka merged 1 commit into
api-platform:5.0from
soyuka:fix/jsonapi-included-notexposed-8700

Conversation

@soyuka

@soyuka soyuka commented Oct 19, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 4.4
Tickets Fixes #8700
License MIT
Doc PR ∅

The JSON:API schema factory skipped related classes whose only operation is NotExposed when building included, which gave anyOf: [] (invalid JSON Schema) for a relation to such a resource, and an incomplete anyOf for a polymorphic relation mixing exposed and non-exposed targets. The serializer does emit them in included (e.g. Product.aggregateRating with ?include=aggregateRating), so the schema now references their own definition like any other target.

The canRead() skip dates back to #5501, which #5722 fixed in metadata (generated NotExposed operations inherit the resource options), the #5501 schema test still passes.

Related resources whose only operation is NotExposed were dropped from
the included anyOf, leaving an empty (invalid) anyOf although the
serializer emits them. Reference their own definition like any other
target.

Fixes api-platform#8700
@soyuka
soyuka force-pushed the fix/jsonapi-included-notexposed-8700 branch from 0434cc2 to 475bcac Compare October 19, 2026 12:17
@soyuka
soyuka changed the base branch from 4.4 to 5.0 October 19, 2026 12:17
@soyuka
soyuka merged commit e03a71b into api-platform:5.0 Oct 19, 2026
117 checks passed
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