Skip to content

fix(json-schema): keep operation groups in context - #8643

Merged
soyuka merged 2 commits into
api-platform:5.0from
soyuka:fix/json-schema-explicit-context-groups
Oct 15, 2026
Merged

soyuka merged 2 commits into
api-platform:5.0from
soyuka:fix/json-schema-explicit-context-groups

Conversation

@soyuka

@soyuka soyuka commented Oct 6, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 5.0
Tickets ∅
License MIT
Doc PR ∅

SchemaFactory::buildSchema() used the operation's serializer context only when no context was passed. Any explicit context without groups ([SCHEMA_DRAFT4_VERSION => true] for OpenAPI 3.0, [FORCE_SUBSCHEMA => true] in the MCP loader, ApiTestAssertionsTrait, skip_null_values in the OpenAPI output schemas) lost the operation groups. On top of that the property factories received both directions' groups, so output schemas listed write-only properties flagged writeOnly, and OpenAPI 3.0 and 3.1 docs disagreed.

The operation context is now merged under the explicit one for top-level calls, only the built direction's groups/attributes reach the property factories, and ignored_attributes is read from that same context instead of always from normalization.

Found while mapping Operation usage in json-schema for symfony/symfony#64279.

An explicit serializer context without groups replaced the operation
context, and both directions' groups were passed to the property
factories. OpenAPI 3.0 docs, MCP tool schemas and the test assertions
then exposed write-only properties in output schemas.
Read ignored_attributes from the built direction's context too.
The operation context now fills keys missing from an explicit
context, an unset groups key came back from the operation.
@soyuka
soyuka merged commit dab2e7c into api-platform:5.0 Oct 15, 2026
115 of 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