Building a Decorator Framework
Combine decorators and metadata into a mini framework.
Building a Mini Framework
Now we combine decorators and metadata to build a tiny validation framework. Field decorators record rules into class metadata; a validate function reads them back and checks an instance.
The Plan
We will (1) define field decorators like @minLength and @isEmail that store rules in context.metadata, then (2) write a validate(instance) that walks those rules.
All lessons in this course
- Stage 3 Decorators Explained
- Decorator Metadata
- reflect-metadata and Design Types
- Building a Decorator Framework