Skip to content

fix(metadata): apply defaults that use a can* getter - #8691

Merged
soyuka merged 1 commit into
api-platform:5.0from
Maxcastel:fix/defaults-can-getters
Oct 16, 2026
Merged

soyuka merged 1 commit into
api-platform:5.0from
Maxcastel:fix/defaults-can-getters

Conversation

@Maxcastel

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

addGlobalDefaults() only looks for a get* method, but read, deserialize, validate, write, serialize and map use canRead(), canValidate()... So a default like 'validate' => false was silently moved to the extra properties and did nothing.

On Symfony this only changes map, the bundle already moves the other keys to extra_properties before. On Laravel the defaults are passed as is, so all of them work now.

soyuka

This comment was marked as resolved.

@soyuka

soyuka commented Oct 16, 2026

Copy link
Copy Markdown
Member

my bad actually I thought this was targetting user classes good catch thanks!

@soyuka
soyuka merged commit f4f60aa into api-platform:5.0 Oct 16, 2026
108 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.

2 participants