-
-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Labels
Description
Quite simply here's some code that throws "myArray" is Array type but the schema does not include a "myArray.$" definition for the array items"
:
import SimpleSchema from "simpl-schema";
const schema = new SimpleSchema({
myArray: {
type: Array
},
"myArray.$": {
type: String,
allowedValues: ["foo", "bar"]
}
});
schema.extend({
myArray: {
minCount: 1
}
})
It looks like you can't extend an Array type field, without passing the entire array.$
field again.
Here's a codesandbox: https://codesandbox.io/s/flamboyant-tdd-hy0mg?file=/src/index.js:0-241