Repository navigation
feat(serializer): Add a max_breadth option to limit the items serialized from arrays and objects - #2283
Open
Amoifr wants to merge 1 commit into
Open
feat(serializer): Add a max_breadth option to limit the items serialized from arrays and objects#2283Amoifr wants to merge 1 commit into
Amoifr wants to merge 1 commit into
Conversation
…zed from arrays and objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2257
Adds an opt-in
max_breadthoption (defaultnull, so nothing changes unless it's set). When set,AbstractSerializerstops serializing an array or an object after that many items and adds a{truncated}entry with the number of items left out (e.g.'{truncated}' => '499990 more items'). It applies to both the frame arguments (RepresentationSerializer) and the query bindings (Serializer).With the reproduction script from the issue: peak memory goes from +241.3 MB to +0.6 MB, and from 613 ms to 2 ms, with
max_breadth: 10.As requested, no
_metais introduced here. Happy to rename the option or change the marker format if you prefer something else!