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

fix: unary op shorthand unsupported #142

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions json/targeting.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,19 @@
}
},
"unaryOp": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"$ref": "#/definitions/args"
}
"anyOf": [
Copy link
Member Author

Choose a reason for hiding this comment

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

Support either an array of length 1 or just the arg itself!

{
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"$ref": "#/definitions/args"
}
},
{
"$ref": "#/definitions/args"
}
]
},
"unaryRule": {
"title": "Unary Operation",
Expand Down
12 changes: 7 additions & 5 deletions json/targeting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,13 @@ definitions:
of arguments.
$ref: "#/definitions/associativeOp"
unaryOp:
type: array
minItems: 1
maxItems: 1
items:
$ref: "#/definitions/args"
anyOf:
- type: array
minItems: 1
maxItems: 1
items:
"$ref": "#/definitions/args"
- "$ref": "#/definitions/args"
unaryRule:
title: Unary Operation
description: Any primitive JSONLogic operation with 1 operands.
Expand Down
1 change: 1 addition & 0 deletions json/test/positive/basic-json-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{"!=" : [1, 2]},
{"!==" : [1, 2]},
{"!": [true]},
{"!": true},
Copy link
Member Author

Choose a reason for hiding this comment

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

This failed to validate before the change.

{"!!": ["0"] },
{"or": [true, false]},
{"or":[false, 0, "a"]},
Expand Down
Loading