Skip to content

Commit b7a7ad8

Browse files
committed
Compare restriction relations, remove RangeRestriction from case properties
1 parent f3b777b commit b7a7ad8

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

libraries/dictionary/README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ The `then` object contains the restrictions that will be applied when the `if` c
142142

143143
A requirement condition is defined by providing a field name or list of field names from this schema, and the matching rules that satisfy this condition. If multiple field names are provided, a `case` property can be added to specify how many of their values must pass the matching rules (`all`, `any`, or `none` of them).
144144

145-
| Property | Required | Default | Type | Description | Example |
146-
| ----------- | -------- | ------- | ----------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
147-
| `fields` | Required | | `Array<NameString>` | Names of fields from the same schema. This match rule will be applied to all fields listed - see `case` to determine the rules for how many of these fields must match. All specified fields must store values of the same type. | `["some_field"]` |
148-
| `match` | Required | | `MatchRules` object | Matching rules for the values of the `fields`. All rules included in this object will be tested and all must be pass - this is not affected by the `case` property. [Conditional Match Rules](#conditional-match-rules) | `{ "value": "Hello World" }` |
149-
| `arrayCase` | Optional | `all` | `all`, `any`, `none`, or [`RangeRule`](#rangerule-data-structure) | When the specified field(s) are an array type, the `arrayCase` dictates how many of the values in the array must pass the matching rules. `all` requires all values in the array to pass the matching rule. `any` requires at least one value in the array to match. | `any` |
150-
| `case` | Optional | `all` | `all`, `any`, `none`, or [`RangeRule`](#rangerule-data-structure) | Defines how many of the listed `fields` must have a value that matches the `match` rules. `all` requires all fields values to have matching values. `any` requires at least one field to have a matching value. `none` requires that there none of the specified fields have values that match. | `any` |
145+
| Property | Required | Default | Type | Description | Example |
146+
| ---------------- | -------- | ------- | -------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
147+
| `fields` | Required | | `Array<NameString>` | Names of fields from the same schema. This match rule will be applied to all fields listed - see `case` to determine the rules for how many of these fields must match. All specified fields must store values of the same type. | `["some_field"]` |
148+
| `match` | Required | | `MatchRules` object | Matching rules for the values of the `fields`. All rules included in this object will be tested and all must be pass - this is not affected by the `case` property. [Conditional Match Rules](#conditional-match-rules) | `{ "value": "Hello World" }` |
149+
| `arrayFieldCase` | Optional | `all` | `all`, `any`, `none` | When a specified field is an array type, the `arrayFieldCase` dictates how many of the values in the array must pass the matching rules. `all` requires all values in the array to pass the matching rule. `any` requires at least one value in the array to match. `non` requires that none of the values in the array match. | `any` |
150+
| `case` | Optional | `all` | `all`, `any`, `none` | Defines how many of the listed `fields` must have a value that matches the `match` rules. `all` requires all fields values to have matching values. `any` requires at least one field to have a matching value. `none` requires that there none of the specified fields have values that match. | `any` |
151151

152152
> **Example Conditional Restriction**: match single value
153153
>
@@ -241,15 +241,24 @@ A `RangeRule` cannot include but an inclusive and exclusive version of min, or o
241241
> }
242242
> ```
243243
244-
| Property | Required | Default | Type | Description |
245-
| ---------- | -------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
246-
| `fields` | Required | | `string` or `Array<string>` | The field(s) that the values of will be compared to. These fields will be refered to throughout this section as _compared to_ fields. All these fields need to be the same type as the field(s) they will be compared to. |
247-
| `relation` | Required | | `equal`, `not_equal`, `contains`, `contained_in`, `greater_than`, `lesser_than` | The relation between the values of the test field and the compared to fields. See [ComparedFieldsRule Relations](#comparedfieldsrule-relations). |
248-
| `case` | Optional | `all`, `any`, `none`, or [`RangeRule`](#rangerule-data-structure) | MatchCase (RangeRule or one of: `all`, `any`, `none`) | How many of the _compared to_ fields must pass the comparison for this rule to pass. |
244+
| Property | Required | Default | Type | Description |
245+
| ---------- | -------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
246+
| `fields` | Required | | `string` or `Array<string>` | The field(s) that the values of will be compared to. These fields will be refered to throughout this section as _compared to_ fields. All these fields need to be the same type as the field(s) they will be compared to. |
247+
| `relation` | Required | | `equal`, `notEqual`, `contains`, `containedIn`, `greaterThan`, `greaterThanOrEqual`, `lesserThan`, `lesserThanOrEqual` | The relation between the values of the test field and the compared to fields. See [ComparedFieldsRule Relations](#comparedfieldsrule-relations). |
248+
| `case` | Optional | `all`, `any`, `none` | MatchCase (RangeRule or one of: `all`, `any`, `none`) | How many of the _compared to_ fields must pass the comparison for this rule to pass. |
249249
250250
#### ComparedFieldsRule Relations
251251
252-
**`equal`**:
252+
| Relation Value | Allowable Field Types | Description |
253+
| ------------------------ | --------------------- | :--------------------------------------------------------------------------------------------------------- |
254+
| **`equal`**: | all | Checks that the current field and the comapred field(s) have the same value |
255+
| **`notEqual`**: | all | Checks that the current field and the comapred field(s) do not have the same value |
256+
| **`contains`** | `string` | Checks that the value of the current field completely contains the value of the compared field(s) |
257+
| **`containedIn`** | `string` | Checks that the value of the current field is completely contained in the value of the compared field(s) |
258+
| **`greaterThan`** | `number`, `integer` | Checks that the value of the current field is greater than (exclusive) the value of the compared field(s). |
259+
| **`greaterThanOrEqual`** | `number`, `integer` | Checks that the value of the current field is greater than or equal to the value of the compared field(s). |
260+
| **`lesserThan`** | `number`, `integer` | Checks that the value of the current field is lesser than (exclusive) the value of the compared field(s). |
261+
| **`lesserThanOrEqual`** | `number`, `integer` | Checks that the value of the current field is lesser than or equal to the value of the compared field(s). |
253262
254263
255264
## Schema Definition for Lectern Developers

0 commit comments

Comments
 (0)