dandi

🌻A modular DI, MVC, and Model binding/validation framework for NodeJS and TypeScript or ES6

View the Project on GitHub just-dandi/dandi

@dandi/model-builder

The @dandi/model-builder package contains utilities for dynamically constructing and validating models defined using decorators from @dandi/model.

While ModelBuilder can be used on its own, is used by several other Dandi packages to provide automatic construction and validation of data models:

ModelBuilder

The ModelBuilder interface exposes two methods for working with models. constructModel is used for converting a POJO (“Plain Old JavaScript Object”) into an instance of a desired model class. constructMember is used to convert individual values to a specified type.

ModelBuilderOptions

Providing options to constructModel or constructMember calls will allow you to configure validation, transform the keys of your source object, or for constructModel, transform the source object itself before construction.

MetadataModelBuilder

MetadataModelBuilder is the default implementation of ModelBuilder and is included in the @dandi/model-builder package.

MetadataModelBuilder uses the metadata generated by using decorators from @dandi/model to define a model. Some things to note about using MetadataModelBuilder: