Skip to content
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
24 changes: 5 additions & 19 deletions json/targeting.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,6 @@
}
}
},
"ifRule": {
"type": "object",
"additionalProperties": false,
"properties": {
"if": {
"title": "If Operator",
"description": "The if statement takes 1-3 arguments: a condition (\"if\"), what to do if its true (\"then\", optional, defaults to returning true), and what to do if its false (\"else\", optional, defaults to returning false). Note that the form accepting more than 3 arguments (else-if) is not supported in flagd; use nesting instead.",
"type": "array",
"minItems": 1,
"maxItems": 3,
"items": {
"$ref": "#/$defs/args"
}
}
}
},
"binaryOrTernaryOp": {
"type": "array",
"minItems": 2,
Expand Down Expand Up @@ -190,6 +174,11 @@
"type": "object",
"additionalProperties": false,
"properties": {
"if": {
"title": "If Operator",
"description": "The if statement takes 1 or more arguments: a condition (\"if\"), what to do if its true (\"then\", optional, defaults to returning true), and what to do if its false (\"else\", optional, defaults to returning false). Note that the else condition can be used as an else-if statement by adding additional arguments.",
"$ref": "#/$defs/variadicOp"
},
"==": {
"title": "Lose Equality Operation",
"description": "Tests equality, with type coercion. Requires two arguments.",
Expand Down Expand Up @@ -560,9 +549,6 @@
{
"$ref": "#/$defs/missingSomeRule"
},
{
"$ref": "#/$defs/ifRule"
},
{
"$ref": "#/$defs/binaryRule"
},
Expand Down
21 changes: 4 additions & 17 deletions json/targeting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,6 @@ type: object
- type: array
items:
type: string
ifRule:
type: object
additionalProperties: false
properties:
if:
title: If Operator
description: 'The if statement takes 1-3 arguments: a condition ("if"), what to
do if its true ("then", optional, defaults to returning true),
and what to do if its false ("else", optional, defaults to returning false).
Note that the form accepting more than 3 arguments (else-if) is not supported in flagd;
use nesting instead.'
type: array
minItems: 1
maxItems: 3
items:
$ref: "#/$defs/args"
binaryOrTernaryOp:
type: array
minItems: 2
Expand Down Expand Up @@ -149,6 +133,10 @@ type: object
type: object
additionalProperties: false
properties:
"if":
title: "If Operator"
description: "The if statement takes 1 or more arguments: a condition (\"if\"), what to do if its true (\"then\", optional, defaults to returning true), and what to do if its false (\"else\", optional, defaults to returning false). Note that the else condition can be used as an else-if statement by adding additional arguments."
$ref: "#/$defs/variadicOp"
"==":
title: Lose Equality Operation
description: Tests equality, with type coercion. Requires two arguments.
Expand Down Expand Up @@ -428,7 +416,6 @@ type: object
- $ref: "#/$defs/varRule"
- $ref: "#/$defs/missingRule"
- $ref: "#/$defs/missingSomeRule"
- $ref: "#/$defs/ifRule"
- $ref: "#/$defs/binaryRule"
- $ref: "#/$defs/binaryOrTernaryRule"
- $ref: "#/$defs/associativeRule"
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 @@ -10,6 +10,7 @@
"defaultVariant": "on",
"targeting": {
"*" : [
{"if" : [false, "false", false, "false", true, "true"] },
{"if" : [ true, "yes", "no" ]},
{"if" : [ true, "yes" ]},
{"if" : [ true ]},
Expand Down