Skip to content

Normalize non-resource objects in a standalone normalizer#2679

Merged
soyuka merged 2 commits into
api-platform:2.4from
teohhanhui:fix/normalize-non-resource
Apr 6, 2019
Merged

Normalize non-resource objects in a standalone normalizer#2679
soyuka merged 2 commits into
api-platform:2.4from
teohhanhui:fix/normalize-non-resource

Conversation

@teohhanhui

@teohhanhui teohhanhui commented Apr 2, 2019

Copy link
Copy Markdown
Contributor
Q A
Bug fix? yes
New feature? no
BC breaks? only for a new change introduced in 2.4
Deprecations? no
Tests pass? yes
Fixed tickets api-platform/api-platform#1085
License MIT
Doc PR N/A

Note: Includes a minor BC break because we undo a new change introduced in 2.4. I think it's okay because $handleNonResource was internal anyway. The only people affected would be those who have extended AbstractItemNormalizer and explicitly pass that optional parameter (which, actually, still wouldn't result in an error anyway).

TODO:

Comment thread features/main/input_output.feature Outdated
"@type": "User",
"@id": "/users/1",
"dummy": "/dummies/1"
"dummy": {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be handled better?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be better to have @id as a string no?

@bastnic

bastnic commented Apr 3, 2019

Copy link
Copy Markdown
Contributor

seems cleaner (and better performance, I hope)

@toriqo

toriqo commented Apr 4, 2019

Copy link
Copy Markdown
Contributor

when using application/vnd.api+json or application/hal+json, non-resources are now properly serialized and returned based on contexts

@soyuka

soyuka commented Apr 4, 2019

Copy link
Copy Markdown
Member

@teohhanhui my test case also covers @toriqo issue, should I duplicate it to make it run with other formats?

@teohhanhui

Copy link
Copy Markdown
Contributor Author

@soyuka I'll take care of that, since I've been working on something since yesterday.

@teohhanhui
teohhanhui force-pushed the fix/normalize-non-resource branch 3 times, most recently from 4812d4e to d9bb3c1 Compare April 5, 2019 12:55

@soyuka soyuka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! Really good to have removed this handleNonResource parameter and I feel that the code is a step forward to simplify composition! Good job!

Comment thread .travis.yml
@bastnic

bastnic commented Apr 5, 2019

Copy link
Copy Markdown
Contributor

I like it! Really good to have removed this handleNonResource parameter and I feel that the code is a step forward to simplify composition! Good job!

+100

@teohhanhui
teohhanhui force-pushed the fix/normalize-non-resource branch 3 times, most recently from 31ea473 to 2893263 Compare April 5, 2019 18:43
@teohhanhui
teohhanhui force-pushed the fix/normalize-non-resource branch from 2893263 to 8f27927 Compare April 5, 2019 21:22
@teohhanhui
teohhanhui force-pushed the fix/normalize-non-resource branch from 8f27927 to 521fa98 Compare April 6, 2019 08:53
@soyuka
soyuka merged commit b7afbf8 into api-platform:2.4 Apr 6, 2019
@soyuka

soyuka commented Apr 6, 2019

Copy link
Copy Markdown
Member

Thanks @teohhanhui

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.

4 participants