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
9 changes: 7 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,20 @@ Each fixture file is a single JSON object. Schema: `schemas/precomputed-assignme
|-------|------|----------|-------------|
| `flag` | string | yes | Flag key to evaluate |
| `variationType` | string | yes | `boolean`, `string`, `integer`, `float`, or `object` |
| `defaultValue` | any | yes | Default value passed to the getter |
| `defaultValue` | matches `variationType` | yes | Default value passed to the getter |
| `expectedResult` | object | yes | Expected outcome |
| `expectedResult.value` | any | yes | Expected flag value |
| `expectedResult.value` | matches `variationType` | yes | Expected flag value |
| `expectedResult.reason` | string? | no | Expected reason code (null if error) |
| `expectedResult.errorCode` | string? | no | Expected error code (null if success) |
| `expectedResult.variantKey` | string? | no | Expected variation key (null if error) |
| `_skip` | array | no | Skip this evaluation for listed platforms |
| `_include` | array | no | Run this evaluation only for listed platforms |

`defaultValue` and `expectedResult.value` must use the JSON type declared by
`variationType`: boolean, string, integer, number for `float`, or object.
`float` accepts any JSON number; `integer` accepts only integral JSON numbers
(including `1.0`). Arrays and null are not valid for either field.

### Event matchers

Matchers in `expectations.exposures` and `expectations.evaluationEvents` are
Expand Down
5 changes: 5 additions & 0 deletions precomputed-assignments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ Each evaluation calls a typed getter on the SDK and asserts the result:
}
```

`defaultValue` and `expectedResult.value` must use the JSON type declared by
`variationType`: boolean, string, integer, number for `float`, or object.
`float` accepts any JSON number; `integer` accepts only integral JSON numbers
(including `1.0`). Arrays and null are not valid for either field.

Evaluations may carry `_skip` or `_include` to control per-platform applicability.

## Expectations and event matchers
Expand Down
126 changes: 124 additions & 2 deletions schemas/precomputed-assignment.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"additionalProperties": false,
"properties": {
"value": {
"description": "Expected flag value."
"description": "Expected flag value; must match the evaluation variationType."
},
"reason": {
"type": ["string", "null"],
Expand Down Expand Up @@ -117,7 +117,7 @@
"description": "Type to request from the SDK getter."
},
"defaultValue": {
"description": "Default value passed to the getter."
"description": "Default value passed to the getter; must match variationType."
},
"expectedResult": {
"$ref": "#/$defs/ExpectedResult"
Expand All @@ -129,6 +129,128 @@
"$ref": "#/$defs/PlatformFilter"
}
},
"allOf": [
{
"if": {
"properties": {
"variationType": {
"const": "boolean"
}
},
"required": ["variationType"]
},
"then": {
"properties": {
"defaultValue": {
"type": "boolean"
},
"expectedResult": {
"properties": {
"value": {
"type": "boolean"
}
}
}
}
}
},
{
"if": {
"properties": {
"variationType": {
"const": "string"
}
},
"required": ["variationType"]
},
"then": {
"properties": {
"defaultValue": {
"type": "string"
},
"expectedResult": {
"properties": {
"value": {
"type": "string"
}
}
}
}
}
},
{
"if": {
"properties": {
"variationType": {
"const": "integer"
}
},
"required": ["variationType"]
},
"then": {
"properties": {
"defaultValue": {
"type": "integer"
},
"expectedResult": {
"properties": {
"value": {
"type": "integer"
}
}
}
}
}
},
{
"if": {
"properties": {
"variationType": {
"const": "float"
}
},
"required": ["variationType"]
},
"then": {
"properties": {
"defaultValue": {
"type": "number"
},
"expectedResult": {
"properties": {
"value": {
"type": "number"
}
}
}
}
}
},
{
"if": {
"properties": {
"variationType": {
"const": "object"
}
},
"required": ["variationType"]
},
"then": {
"properties": {
"defaultValue": {
"type": "object"
},
"expectedResult": {
"properties": {
"value": {
"type": "object"
}
}
}
}
}
}
],
"not": {
"required": ["_skip", "_include"]
}
Expand Down