Skip to content

Commit e69df49

Browse files
committed
Simplify references example
1 parent da65f31 commit e69df49

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,16 @@ const person = object({
105105
age: number(),
106106
})
107107

108-
const team = object(
109-
{
110-
leader: $ref('person'),
111-
members: array($ref('person')),
112-
},
113-
{
114-
$defs: { person },
115-
},
116-
)
108+
const team = object({
109+
leader: $ref('person'),
110+
members: array($ref('person')),
111+
})
112+
113+
team.$defs = { person }
117114
```
118115

116+
> Read more about `$ref` and `$defs` in the [JSON Schema Documentation](https://json-schema.org/understanding-json-schema/structuring#dollarref)
117+
119118
## 🔀 Using Union Types
120119

121120
Create union types using `anyOf` to allow multiple possible schemas:

0 commit comments

Comments
 (0)