From d23cec6ed98cd33ba617dacbf05deab9398f82a4 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Tue, 16 Apr 2024 09:26:57 -0400 Subject: [PATCH] chore: update public schema Signed-off-by: Todd Baert --- docs/schema/v0/targeting.json | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/docs/schema/v0/targeting.json b/docs/schema/v0/targeting.json index 1b58ece94..0799285a0 100644 --- a/docs/schema/v0/targeting.json +++ b/docs/schema/v0/targeting.json @@ -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, @@ -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.", @@ -486,7 +475,7 @@ "items": [ { "description": "Bucketing value used in pseudorandom assignment; should be unique and stable for each subject of flag evaluation. Defaults to a concatenation of the flagKey and targetingKey.", - "$ref": "#/$defs/varRule" + "$ref": "#/$defs/anyRule" }, { "$ref": "#/$defs/fractionalWeightArg" @@ -527,8 +516,9 @@ "reference": { "additionalProperties": false, "type": "object", - "properties": { - "$ref": { + "$comment": "patternProperties here is a bit of a hack to prevent this definition from being dereferenced early.", + "patternProperties": { + "^\\$ref$": { "title": "Reference", "description": "A reference to another entity, used for $evaluators (shared rules).", "type": "string" @@ -559,9 +549,6 @@ { "$ref": "#/$defs/missingSomeRule" }, - { - "$ref": "#/$defs/ifRule" - }, { "$ref": "#/$defs/binaryRule" },