From 3110c54cff0a997fa70f841dfe9b3a1f3b511a2d Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Thu, 23 May 2024 14:14:23 -0400 Subject: [PATCH] fix: unary op shorthand unsupported Signed-off-by: Todd Baert --- json/targeting.json | 19 +++++++++++++------ json/targeting.yaml | 12 +++++++----- json/test/positive/basic-json-ops.json | 1 + 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/json/targeting.json b/json/targeting.json index 250e2a2..3818343 100644 --- a/json/targeting.json +++ b/json/targeting.json @@ -285,12 +285,19 @@ } }, "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", diff --git a/json/targeting.yaml b/json/targeting.yaml index 1f39c8d..5e726c8 100644 --- a/json/targeting.yaml +++ b/json/targeting.yaml @@ -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. diff --git a/json/test/positive/basic-json-ops.json b/json/test/positive/basic-json-ops.json index d6f9882..f1239b7 100644 --- a/json/test/positive/basic-json-ops.json +++ b/json/test/positive/basic-json-ops.json @@ -19,6 +19,7 @@ {"!=" : [1, 2]}, {"!==" : [1, 2]}, {"!": [true]}, + {"!": true}, {"!!": ["0"] }, {"or": [true, false]}, {"or":[false, 0, "a"]},