docs: add "how to register schema with refs" (#294)

pull/295/head
Sor4chi 2023-12-07 21:31:03 +09:00 committed by GitHub
parent 186ce0db8e
commit 80f46a4c40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -51,6 +51,10 @@ const UserSchema = z
.openapi('User')
```
> [!TIP]
> `UserSchema` schema will be registered as `"#/components/schemas/User"` refs in the OpenAPI document.
> If you want to register the schema as referenced components, use `.opanapi()` method.
Next, create a route:
```ts