You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e309d7a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -537,6 +537,27 @@ app.listen(3000);
537
537
538
538
Without a schema adapter, Zeta will throw an error when trying to access the `/openapi.json` endpoint, but it's not needed if you only want to validate inputs and response bodies.
539
539
540
+
### Model References
541
+
542
+
By default, Zeta will not put any models in `components.schemas` nor add `$ref` for those models.
543
+
544
+
You are in charge of determining which models should be added to `components.schemas` by adding a `ref` meta to the model's schema:
545
+
546
+
```ts
547
+
import { z } from"zod";
548
+
549
+
const User =z
550
+
.object({
551
+
id: z.string().uuid(),
552
+
email: z.string().email(),
553
+
})
554
+
.meta({
555
+
ref: "User",
556
+
});
557
+
```
558
+
559
+
When building your app's spec, Zeta will find these `ref` properties and move the object schemas into `components.schemas`.
560
+
540
561
## Composing Multiple Apps
541
562
542
563
By default, an app's context (hooks, decorators) is isolated. To make a child app's context available to its parent, you must explicitly chain `.export()` at the end of its definition. This effectively merges its isolated lifecycle hooks into the parent's.
0 commit comments