Schema Providers
How to provide schemas from model constructors
Last updated
Was this helpful?
How to provide schemas from model constructors
Last updated
Was this helpful?
This way of defining schemas is particularly useful when dealing with recursive models (see for an example).
To create a schema provider, the class or constructor function must provide a static getRevivalSchema
function.
When using a class, the getRevivalSchema
function must be static.
When using functions, the function must expose a getRevivalSchema
function.
This way, when reviving a model using revive(json, Employee)
the schema provided by the Employee
class will be used.