Skip to content

fix(jsonschema): keep null on nullable collections - #8845

Merged
soyuka merged 2 commits into
api-platform:5.0from
soyuka:fix/schema-nullable-object-collection
Nov 13, 2026
Merged

soyuka merged 2 commits into
api-platform:5.0from
soyuka:fix/schema-nullable-object-collection

Conversation

@soyuka

@soyuka soyuka commented Nov 13, 2026

Copy link
Copy Markdown
Member

A nullable collection of objects (?array with list<Dto>|null) produced
{"type":"array","items":{"$ref":...}}: the collection branches of
SchemaFactory::buildPropertySchema() wrote the schema and emptied $refs,
so the nullable branch never ran. Validating against that schema rejects
null, e.g. MCP tool arguments: "Expected array, but received null".

The type now becomes ["array","null"]; the OpenAPI 3.0 normalizer already
maps it to nullable: true.

@soyuka
soyuka merged commit 18ae476 into api-platform:5.0 Nov 13, 2026
116 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