Skip to content

Metadata: Attributes default value should be null not an empty array #2685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2019

Conversation

soyuka
Copy link
Member

@soyuka soyuka commented Apr 4, 2019

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

In every other metadata factory, we check if attributes is null. The AnnotationResourceMetadataFactory is one of the first to run and sets the attributes to an empty array. This then blocks other metadata factories, and they will not set the attributes value because it's not null.

@soyuka soyuka force-pushed the fix-attributes-override-2 branch from e054f96 to e74ce08 Compare April 5, 2019 09:19
@soyuka soyuka merged commit a20bb89 into api-platform:2.4 Apr 5, 2019
@soyuka soyuka deleted the fix-attributes-override-2 branch April 5, 2019 09:49
@teohhanhui
Copy link
Contributor

teohhanhui commented Apr 5, 2019

I think the bug is real, but the fix is wrong. The default value for attributes property should be changed to null in the annotation. Hmm, actually we should check for empty array in the other factories instead.

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