Required fields and default values (#5835)

* Add field options to mongo schema metadata

* Add/fix test with fields options

* Add required validation failing test

* Add more tests

* Only set default value if field is undefined

* Fix redis test

* Fix tests

* Test for creating a new class with field options

* Validate default value type

* fix lint (weird)

* Fix lint another way

* Add tests for beforeSave trigger and solve small issue regarding the use of unset in the beforeSave trigger
This commit is contained in:
Antonio Davi Macedo Coelho de Castro
2019-07-25 21:13:59 -07:00
committed by GitHub
parent d3810c2eba
commit fd637ff4f8
8 changed files with 606 additions and 40 deletions

View File

@@ -5,6 +5,8 @@ export type LoadSchemaOptions = {
export type SchemaField = {
type: string,
targetClass?: ?string,
required?: ?boolean,
defaultValue?: ?any,
};
export type SchemaFields = { [string]: SchemaField };