fix: Ensure the keepArray node parameter is taken into the account.#13
Open
WojciechMatuszewskiStedi wants to merge 2 commits intosaasquatch:mainfrom
Open
fix: Ensure the keepArray node parameter is taken into the account.#13WojciechMatuszewskiStedi wants to merge 2 commits intosaasquatch:mainfrom
keepArray node parameter is taken into the account.#13WojciechMatuszewskiStedi wants to merge 2 commits intosaasquatch:mainfrom
Conversation
fix: Ensure the keepArray parameter is taken into the account
Author
|
cc @loganvolkers , @00salmon |
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.
Description
First of all, thank you for this library. It's very helpful!
When I was playing with the expression to AST conversion back and forth, I noticed that the
keepArrayproperties on a given node are not considered during the conversion from AST to a string expression.Reproduction
Given the expression
The produced AST using jsonata v1.7 yields:
{ "type": "path", "steps": [ { "value": "foo", "type": "name", "position": 3 }, { "type": "unary", "value": "{", "position": 5, "lhs": [ [ { "type": "path", "steps": [{ "value": "bar", "type": "name", "position": 8 }] }, { "value": "baz", "type": "string", "position": 15 } ] ], "keepArray": true } ], "keepSingletonArray": true }Now, if we serialize the above AST back to an expression form, the result is as follows:
As you can see, we are missing the
[]at the end of the expressionUncertainty
I'm not sure what
keepSingletonArrayis responsible for. I would be grateful for any guidance regarding this property - mainly is my contribution correct in relation to thekeepSingletonArrayproperty as well?