@bedrockio/model 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/schema.js +4 -0
- package/package.json +1 -1
- package/src/schema.js +4 -0
package/dist/cjs/schema.js
CHANGED
|
@@ -118,7 +118,11 @@ function attributesToMongoose(attributes) {
|
|
|
118
118
|
} else if (key === 'validate' && type === 'string') {
|
|
119
119
|
// Allow custom mongoose validation function that derives from the schema.
|
|
120
120
|
val = (0, _validation.getNamedValidator)(val);
|
|
121
|
+
} else if (key === 'attributes' && type === 'object') {
|
|
122
|
+
val = attributesToMongoose(val);
|
|
121
123
|
}
|
|
124
|
+
} else if (Array.isArray(val)) {
|
|
125
|
+
val = val.map(attributesToMongoose);
|
|
122
126
|
} else if ((0, _lodash.isPlainObject)(val)) {
|
|
123
127
|
if (isScopeExtension(val)) {
|
|
124
128
|
applyScopeExtension(val, definition);
|
package/package.json
CHANGED
package/src/schema.js
CHANGED
|
@@ -128,7 +128,11 @@ function attributesToMongoose(attributes) {
|
|
|
128
128
|
} else if (key === 'validate' && type === 'string') {
|
|
129
129
|
// Allow custom mongoose validation function that derives from the schema.
|
|
130
130
|
val = getNamedValidator(val);
|
|
131
|
+
} else if (key === 'attributes' && type === 'object') {
|
|
132
|
+
val = attributesToMongoose(val);
|
|
131
133
|
}
|
|
134
|
+
} else if (Array.isArray(val)) {
|
|
135
|
+
val = val.map(attributesToMongoose);
|
|
132
136
|
} else if (isPlainObject(val)) {
|
|
133
137
|
if (isScopeExtension(val)) {
|
|
134
138
|
applyScopeExtension(val, definition);
|