Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interface #704

Merged
merged 3 commits into from
Sep 27, 2024
Merged

Update interface #704

merged 3 commits into from
Sep 27, 2024

Conversation

DevDimov
Copy link
Contributor

@DevDimov DevDimov commented Jul 4, 2024

Update interface property ExprNode.lhs to be either an ExprNode or ExprNode[] as described in issue #703

For example, jsonata('($x := 1; $y := 2;)').ast().expressions outputs an object as the value for lhs.

[
  {
    type: "bind",
    value: ":=",
    position: 7,
    lhs: { value: "x", type: "variable", position: 4 },
    rhs: { value: 1, type: "number", position: 9 },
  },
  {
    type: "bind",
    value: ":=",
    position: 15,
    lhs: { value: "y", type: "variable", position: 13 },
    rhs: { value: 2, type: "number", position: 16 },
  },
];

And jsonata('{"x": y, "z": 1}').ast() outputs an array as the value for lhs.

{
      "type": "unary",
      "value": "{",
      "position": 1,
      "lhs": [
        [
          {
            "value": "x",
            "type": "string",
            "position": 4
          },
          {
            "type": "path",
            "steps": [
              {
                "value": "y",
                "type": "name",
                "position": 7
              }
            ]
          }
        ],
        [
          {
            "value": "z",
            "type": "string",
            "position": 12
          },
          {
            "value": 1,
            "type": "number",
            "position": 15
          }
        ]
      ]
    }

Similar issue: #585

I've also added all the possible string types for ExprNode.type

Signed-off-by: Vlad Dimov [email protected]

DevDimov and others added 3 commits July 4, 2024 07:55
Update interface property ExprNode.lhs to be either an ExprNode or ExprNode[] as described in issue jsonata-js#703
List all possible string types
Copy link
Member

@mattbaileyuk mattbaileyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this update to the TS bindings

@mattbaileyuk mattbaileyuk merged commit 222bb63 into jsonata-js:master Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants