You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(fractional): support nested JSON Logic expressions as bucket variant names
The operator already recurses into array elements via evaluator.evaluate(),
so nested expressions (if, var, fractional) in bucket variant positions
worked at runtime. The only blocker was the JSON Schema enforcing
"type": "string" for fractionalWeightArg[0].
Change fractionalWeightArg first element to oneOf[string, anyRule] so
the schema accepts JSON Logic objects as variant names in strict mode.
Also:
- pub mod fractional (was private) to allow direct access in tests
- Add integration tests for nested if, nested fractional, and var
as bucket variant names (closes#30)
- Add statistical distribution uniformity test (mirrors Java PR #1740)
- Add boundary-key test (mirrors Java PR #1740 edgeCasesDoNotThrow)
Signed-off-by: Simon Schrottner <simon.schrottner@aepfli.at>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Copy file name to clipboardExpand all lines: schemas/targeting.json
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -461,8 +461,15 @@
461
461
"maxItems": 2,
462
462
"items": [
463
463
{
464
-
"description": "If this bucket is randomly selected, this string is used to as a key to retrieve the associated value from the \"variants\" object.",
465
-
"type": "string"
464
+
"description": "If this bucket is randomly selected, this value (or the string result of evaluating this JSON Logic expression) is used as a key to retrieve the associated value from the \"variants\" object.",
465
+
"oneOf": [
466
+
{
467
+
"type": "string"
468
+
},
469
+
{
470
+
"$ref": "#/definitions/anyRule"
471
+
}
472
+
]
466
473
},
467
474
{
468
475
"description": "Weighted distribution for this variant key.",
0 commit comments