Skip to content

Commit a21b2cf

Browse files
docs: Clarify resolveData docs (#3311)
1 parent 9129481 commit a21b2cf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs/api/schema/resolvers.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
outline: deep
33
---
4-
54
# Resolvers
65

76
Resolvers dynamically resolve individual properties based on a context, in a Feathers application usually the [hook context](../hooks.md#hook-context).
@@ -155,11 +154,11 @@ const userResolver = resolve<User, MyContext>(
155154

156155
## Hooks
157156

158-
In a Feathers application, resolvers are used through [hooks](../hooks.md) to convert service method query, data and responses. The context for these resolvers is always the [hook context](../hooks.md#hook-context).
157+
In a Feathers application, resolvers are used through [hooks](../hooks.md) to convert service `query`, `data` and `response`. The context for these resolvers is always the [hook context](../hooks.md#hook-context).
159158

160159
### resolveData
161160

162-
Data resolvers use the `hooks.resolveData(...resolvers)` hook and convert the `data` from a `create`, `update` or `patch` [service method](../services.md) or a [custom method](../services.md#custom-methods). This can be used to validate against the schema and e.g. hash a password before storing it in the database or to remove properties the user is not allowed to write. It is possible to pass multiple resolvers which will run in the order they are passed, using the previous data. `schemaHooks.resolveData` can be used as an `around` and `before` hook.
161+
Data resolvers use the `hooks.resolveData(...resolvers)` hook and convert the `data` from a `create`, `update` or `patch` [service method](../services.md) or a [custom method](../services.md#custom-methods). This can be used to validate against the schema and e.g. hash a password before storing it in the database or to remove properties the user is not allowed to write. It is possible to pass multiple objects containing resolvers which will run in the order they are passed. Subsequent resolver objects will receive the output from previous resolvers. `schemaHooks.resolveData` can be used as an `around` and `before` hook.
163162

164163
```ts
165164
import { hooks as schemaHooks, resolve } from '@feathersjs/schema'

0 commit comments

Comments
 (0)