replace jsonpath-plus with jsonata#30
Merged
Merged
Conversation
refactor: change to async validator for AJV
# Conflicts: # package.json
massfords
commented
Sep 7, 2025
Comment on lines
-15
to
+16
| schemas: [example, payloadTemplateSchema], | ||
| schemas: [ | ||
| { ...example, $async: true }, | ||
| { ...payloadTemplateSchema, $async: true }, |
Owner
Author
There was a problem hiding this comment.
each of the schemas has to be flagged as being async since they may contain formats that are validated by async functions
massfords
commented
Sep 7, 2025
Comment on lines
-46
to
+52
| const result = ajv.validate( | ||
| "https://asl-path-validator.cloud/example.json#", | ||
| input | ||
| const validator = ajv.getSchema( | ||
| "https://asl-path-validator.cloud/example.json#" | ||
| ); | ||
| must(validator); | ||
| const result = await validator(input); |
Owner
Author
There was a problem hiding this comment.
slight change in how async validations are done
we can't use the top level validate function on AJV since that it synchronous. Instead, we get the validator function for the schema and invoke it as an asynchronous function.
The result is the input when no error or it throws. This will be another required change on how this is used in asl-validator
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.
I'm removing the JSONPath library in favor or using JSONata instead. The JSONPath expressions are nicer but this library has had some vulnerabilities requiring hot fixes and the asl-validator is already using JSONata so it would be best to remove the dependency
The breaking change is that the JSONata expression evaluation is asynchronous so the AJV format and its schemas must be configured to be asynchronous.