Skip to content

Commit 17168c7

Browse files
committed
fix: move the required validation to the if schema
This commit moves the `required` validation for the example schema in ch05's lesson "Expanding If-then-else" and places it in the `if` subschema, so that it applies only for the purpose of the condition.
1 parent 273e52c commit 17168c7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/05-Conditional-Validation/06-Expanding-If-then-else/instructions.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ Using the `not` keyword with the `if-else` keyword can look something like this:
4141
"if": {
4242
"properties": {
4343
"status": { "const": "employed" }
44-
}
44+
},
45+
"required": ["status"]
4546
},
4647
"then": {
4748
"not": { "required": ["unemploymentBenefits"]
4849
}
49-
},
50-
"required": ["status"]
50+
}
5151
}
5252
```
5353
- If `status` is `"employed"`, the `unemploymentBenefits` field **must not** be present.

0 commit comments

Comments
 (0)