Skip to content

Commit b1f26d4

Browse files
authored
Modify DSL on conditions for type-is condition operation (#48)
1 parent 8f862dc commit b1f26d4

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

DSL/conditions.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The DSL is structured as an array of conditions, with each condition containing
2525

2626
#### `match-all` Property Explanation
2727

28-
The match-all property allows operations to be applied to all the keywords at a specified path.
28+
The match-all property allows operations to be applied to all the keywords at a specified path. Conditions evaluates to `true` if any of the iterable subschema matches.
2929

3030
Here's a detailed explanation:
3131

@@ -67,24 +67,32 @@ Here's a detailed explanation:
6767

6868
`type-is`: Checks if the type of the target matches the specified type.
6969

70-
- **Value**: Must be a string with one of the primitive types: `integer`, `boolean`, `array`, `object`, `string`, `number`.
70+
- **Value**: Must be either a string representing one of the primitive typesinteger, boolean, array, object, string, number—or an array containing one or more of these types. In the case of an array, the schema will be valid if it matches any of the specified primitive types.
7171

7272
##### Schema
7373

7474
```json
7575
{
76-
"$schema": "https://json-schema.org/draft-03/schema",
77-
"type": [ { "const": "hello" }, "number", "string" ]
76+
"$schema": "https://json-schema.org/draft-02/schema",
77+
"maximumCanEqual": false
7878
}
7979
```
8080

81-
##### Condition
81+
##### Condition for value is a string
8282

8383
```json
8484
[
85-
{ "path": [ "type" ], "operation": "type-is", "value": "array" }
85+
{ "path": [ "type" ], "operation": "type-is", "value": "boolean" }
8686
]
87-
```
87+
```
88+
89+
##### Condition for value is an array
90+
91+
```json
92+
[
93+
{ "path": [ "type" ], "operation": "type-is", "value": [ "array", "object", "boolean" ] }
94+
]
95+
```
8896

8997
#### Equality Checks
9098

0 commit comments

Comments
 (0)