Skip to content
Open
Changes from all 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
4 changes: 2 additions & 2 deletions docs/essential/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ The response should be listed as follows:

Register hook into **every** handler that came after.

To add a global hook, you can use `.schema` followed by a life cycle event in camelCase:
You can add validation schema in global hooks:

```typescript
import { Elysia } from 'elysia'

new Elysia()
.get('/none', () => 'hi')
.schema({ // [!code ++]
.onBeforeHandle({ // [!code ++]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as maintainer suggested, this should be .guard({

query: t.Object({ // [!code ++]
name: t.String() // [!code ++]
}) // [!code ++]
Expand Down