Resolvers
Resolvers are hooks that transform context.data, context.result, or context.params.query on a per-property basis. Each property resolver receives the current value, the full data object, the hook context, and resolver metadata. Resolvers run in parallel and errors are collected into a single BadRequest.
Resolver Hooks
| Resolver | Description |
|---|---|
resolve | Combines |
resolveData | Resolves and transforms |
resolveQuery | Resolves and transforms |
resolveResult | Resolves and transforms |
Resolver Helpers
Resolver helpers are factory functions that return resolver property functions for common operations like omitting fields, trimming strings, or setting defaults.
| Resolver | Description |
|---|---|
defaults | Returns a resolver property that sets a default value when the current value
is |
fromPredicate | Adapts an existing predicate function (like |
lowercase | Returns a resolver property that converts string values to lowercase. Non-string values are passed through unchanged. |
omit | Returns a resolver property that removes the field by returning |
setNow | Returns a resolver property that sets the field to the current timestamp
( |
trim | Returns a resolver property that trims whitespace from string values. Non-string values are passed through unchanged. |
Conditions
Conditions control when a resolver helper is applied. They receive the full ResolverPropertyOptions object and return a boolean. When the condition returns false, the helper is skipped and the original value is preserved.
| Condition | Description |
|---|
