Skip to content

Extending Array type field, erases its nested field #404

@Floriferous

Description

@Floriferous

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions