-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add skipped broken unit test for missing json-logic reduce
support
#98
base: main
Are you sure you want to change the base?
Conversation
src/jsonLogic.js
Outdated
@@ -399,6 +399,7 @@ function checkRuleIntegrity( | |||
subRule.map((item) => { | |||
const isVar = item !== null && typeof item === 'object' && Object.hasOwn(item, 'var'); | |||
if (isVar) { | |||
if (Array.isArray(item.var)) return; // Is an accumlator for reduce and can't be checked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion
Just wondering if there could ever be an array path which we would want to validate? 🤔
Might be safer to be less permissive: const isReducerVar = operator === 'reduce' && Array.isArray(item.var)
This also makes the code more explicit so we don't need code comments. 🙂
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@remoteoss/json-schema-form", | |||
"version": "0.11.8-beta.0", | |||
"version": "0.11.9-dev.20241127210659", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Forgive me, I can't review this, I has been wrapping up my work before going on vacation for the next two weeks. I'll defer to @ollyd here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally getting around to this, i'm gonna add the test case as a todo as you mention ✍️
f544251
to
d0e402b
Compare
reduce
for json logic was not workingreduce
support
rebased with |
This was a bug brought up internally when trying to create a schema similar to the test case. This is because of a false assumption on my side where I didn't need to account for "temp variables" that are indeed supported in json logic for cases like
reduce
.