Keep hidden fields in std.prune#1174
Keep hidden fields in std.prune#1174ricardbejarano wants to merge 1 commit intogoogle:masterfrom ricardbejarano:master
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
CLA signed! |
| @@ -1625,7 +1625,7 @@ limitations under the License. | |||
| [std.prune(x) for x in a if isContent($.prune(x))] | |||
| else if std.isObject(a) then { | |||
| [x]: $.prune(a[x]) | |||
There was a problem hiding this comment.
This way, every hidden field will be unhidden, and this will be a breaking change.
Also, fields referencing self/super will be frozen, and I don't think this is an useful thing after that?
There was a problem hiding this comment.
What about these other options?
std.prune(a, keep_hidden=false)std.prune(a, arrays=true, objects=true, nulls=true, hidden=true)std.pruneEx(a, arrays=true, objects=true, nulls=true, hidden=true)
Showing the default-state function headers here, users would then be able to override whatever they want to be pruned or not.
|
Closing since this is a breaking change. |
According to the docs,
std.prune:However, it also removes hidden fields from objects because it uses
std.objectFieldsto traverse it. This PR changes that to usestd.objectFieldsAllinstead, which keeps hidden fields as promised by the docs.Sort of relates to #1167.