Bug #48532

JsonView Configuration behaves differently for arrays and objects

Added by Alexander Berl about 8 years ago. Updated about 7 years ago.

Status:
Under Review
Priority:
Should have
Category:
MVC
Target version:
-
Start date:
2013-05-25
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

Currently, the behavior for the JsonView configuration is completely different for arrays and objects, which makes configuring anything other than a simple one-level hierarchy output very hard.
See http://lists.typo3.org/pipermail/flow/2013-May/003846.html for more information.

I therefore suggest the following change to the JsonView Configuration:

- arrays and objects should be configured equally apart from the object identifier/class name options
- _only and _exclude should always take precedence and act as a whitelist/blacklist
- _descendAll should also work for objects
- simple type properties/elements should be serialized directly in both cases
- _descend should configure all other array/object properties/elements

If _descend should still act as a second level whitelist, so that all array/object values not configured there are skipped is debatable - it would be more like the current implementation, though from a user POV it is a little bit misleading as to what the difference of _only vs _descend would be.

This would lead to following breaking behaviors:

- arrays are no longer fully evaluated by default (_descend acts as whitelist) or objects are fully evaluated by default (_descend does not whitelist but only sets configuration for subvalues)
- arrays are no longer evaluated deeply by default and need explicit _descendAll configuration for each level

#1

Updated by Gerrit Code Review almost 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21684

#2

Updated by Gerrit Code Review about 7 years ago

Patch set 2 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/21684

Also available in: Atom PDF