Resolver Basics
Resolvers are defined as property maps where each property has a resolver function:Resolver Hooks
The schema system provides hooks for different resolver scenarios:- resolveData
- resolveResult
- resolveQuery
- resolveExternal
Transform data before it reaches the service method:
Property Resolvers
Property resolvers receive four parameters:Virtual Properties
Virtual properties are computed values that don’t exist in the original data:Virtual Properties with $select
Virtual properties work seamlessly with$select:
Secure Data Handling
Use resolvers to protect sensitive data:Multiple Resolvers
Chain multiple resolvers for complex transformations:Converters
Converters transform the entire data object before property resolution:Query Resolvers
Transform query parameters for security and convenience:Resolver Status
Resolvers receive a status object with metadata:Error Handling
Resolvers can throw errors that are automatically collected:Circular Dependency Prevention
Resolvers automatically prevent circular dependencies:Advanced Patterns
Nested Data Resolution
Nested Data Resolution
Resolve nested objects and arrays:
Conditional Resolution
Conditional Resolution
Resolve properties based on conditions:
Pagination with Virtual Properties
Pagination with Virtual Properties
Handle paginated results with virtual properties:
External vs Internal Resolution
External vs Internal Resolution
Use different resolvers for internal and external data:
Resolver with Schema Validation
Combine resolvers with schema validation:Best Practices
Use virtual for computed properties
Always use
virtual() for properties that don’t exist in the original data.Resolve queries for security
Use query resolvers to enforce access control and prevent data leaks.
Separate internal and external
Use
resolveResult for internal data and resolveExternal for client data.Chain resolvers for clarity
Use multiple focused resolvers instead of one complex resolver.
Next Steps
Data Validation
Learn how to validate data with schemas
Schema Overview
Back to schema system overview