Skip to content
Open
Changes from 2 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
20 changes: 20 additions & 0 deletions content/01-Getting-Started/04-Enumerated-Values/instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,24 @@ Now, try to modify the `hobbies` property on the <SideEditorLink/> with `enum` c
Values defined in `enum` are case-sensitive.

So `reading` and `Reading` are considered different values.
</GoodToKnowBox>

<GoodToKnowBox>
There is another nice `keyword` we have which can be used instead of `enum` i.e `oneOf` [keyword](https://json-schema.org/understanding-json-schema/reference/combining#oneOf), this `keyword` validates the given data against exactly one of the given `subschemas` and not the values

**Example:**

```json
{
"department": {
"oneOf": [
{ type: "string", const: "engineering" },
{ type: "string", const: "marketing" },
{ type: "string", const: "sales" },
{ type: "string", const: "HR" },
{ type: "string", const: "finance" }
]
}
}
```
</GoodToKnowBox>