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

feat: support new fields for variables #162

Merged
merged 1 commit into from
Dec 3, 2024
Merged

Conversation

massfords
Copy link
Collaborator

chore: bump asl-path-validator version
chore: npm audit fix
closes: #161

This is the minimum to support the new variables fields

  • add QueryLanguage field to root state machine
  • add QueryLanguage field to states
  • add new JSONata specific fields
  • add some checks for invalid use of JSONPath fields with JSONata query language and vice versa

"asl-path-validator": "^0.14.2",
"asl-path-validator": "^0.15.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

new version supports variables in JSONPath expressions and also adds a new format type for ResultPath fields which are ReferencePath expressions but cannot contain variables.

Comment on lines +142 to +144
},
"Condition": {
"$ref": "jsonata.json#/definitions/condition"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In a JSONata Choice State, each Choice Rule MUST have a "Condition" field. The "Condition" field accepts a boolean value or a JSONata string that must evaluate to a boolean value.

Comment on lines 25 to +26
"ResultPath": {
"$ref": "paths.json#/definitions/asl_ref_path"
"$ref": "paths.json#/definitions/asl_result_path"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In a JSONPath state, the "ResultPath" field MUST NOT reference a variable.

I added a new format type in asl-path-validator to support this

Comment on lines +27 to +29
},
"QueryLanguage": {
"$ref": "jsonata.json#/definitions/queryLanguage"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A state machine specifies its query language in the top-level "QueryLanguage" field, which overrides the default and sets the query language for every state in the state machine.

@massfords
Copy link
Collaborator Author

@ChristopheBougere I'm still not sure what I'm doing wrong with these commit messages. I've got the latest repo, ran install, and did the build before making any changes. My initial commit had a leading blank line but I suspect Webstorm trimmed it. I did a git commit --amend from the command line and added the leading blank line and then force pushed to my branch.

Anyway, if you can take a look and fix it would be appreciated. I think this is a good first pass at supporting the new variables/JSONata feature. There's a fair amount of additional work with respect to validating the JSONata expressions and ensuring that the referenced variables are in scope. There's also other validation like checking the length and naming rules for variables introduced in Assign activities. Perhaps additional work for later.

@massfords massfords marked this pull request as ready for review December 1, 2024 02:35
chore: bump asl-path-validator version
chore: npm audit fix
Copy link
Owner

@ChristopheBougere ChristopheBougere left a comment

Choose a reason for hiding this comment

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

Looking good!

@ChristopheBougere
Copy link
Owner

@ChristopheBougere I'm still not sure what I'm doing wrong with these commit messages. I've got the latest repo, ran install, and did the build before making any changes. My initial commit had a leading blank line but I suspect Webstorm trimmed it. I did a git commit --amend from the command line and added the leading blank line and then force pushed to my branch.

Anyway, if you can take a look and fix it would be appreciated. I think this is a good first pass at supporting the new variables/JSONata feature. There's a fair amount of additional work with respect to validating the JSONata expressions and ensuring that the referenced variables are in scope. There's also other validation like checking the length and naming rules for variables introduced in Assign activities. Perhaps additional work for later.

Sure I will amend the commit message
It seems you just miss a blank line between the title and the body
image

It might be because you squashed your commits and the new commit message wasn't well formatted, or something like this

@ChristopheBougere ChristopheBougere merged commit 61f3d88 into main Dec 3, 2024
1 check passed
@ChristopheBougere ChristopheBougere deleted the mf/variables branch December 3, 2024 17:16
Copy link

github-actions bot commented Dec 3, 2024

🎉 This PR is included in version 3.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support the new JSONata expressions
2 participants