Bug #48532

JsonView Configuration behaves differently for arrays and objects

Added by Alexander Berl about 2 years ago. Updated about 1 year ago.

Status:Under Review Start date:2013-05-25
Priority:Should have Due date:
Assigned To:Alexander Berl % Done:

0%

Category:MVC
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:Git master

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

History

#1 Updated by Gerrit Code Review about 2 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 1 year 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