Setting minCount for all occurrences of an array field in an AutoForm

I’m using SimpleSchema and Autoform together.

One of my schemas is frequently wrapped in array brackets and included / referenced by a larger schema.

I mean something like this, where MyLargerSchema would at the end of the day include two attributes of type [MySubschema]

MySubschema = new SimpleSchema({
  attribute1: {
    type: String,
    optional: true,
    label: "My attribute1",
  },
  attribute2: {
    type: String,
    optional: true,
    label: "My attribute2",
  },
})

MyMediumSchema = new SimpleSchema({
  my_medium_attribute: {
    type: String,
    optional: true,
    label: "My medium attribute",
  },
  my_attributes2: {
    type: [MySubschema],
    label: "My attributes2",
    optional: true,
  },
})

MyLargerSchema = new SimpleSchema({
  my_attributes1: {
    type: [MySubschema],
    label: "My attributes1",
    optional: true,
  },
  my_medium_attributes: {
    type: MyMediumSchema,
    label: "My medium attributes,
    optional: true,
  },
})

For MyLargerSchema we have an autoform like this…

{{#autoForm collection="mycollection" id="myid" type="insert"}}
{{> afQuickFields name='my_attributes1'}}
{{> afQuickFields name='my_medium_attributes'}}
{{/autoForm}}

How can I tweak the autoform invocation so as to set minCount=1 for all the [MySubschema] fields of the resulting form?

What I’ve done is to tweak the schemas as in https://github.com/aldeed/meteor-autoform#putting-field-attribute-defaults-in-the-schema

The [MySubschema] inclusions / references now look as follows:

MyMediumSchema = new SimpleSchema({
  my_medium_attribute: {
    type: String,
    optional: true,
    label: "My medium attribute",
  },
  my_attributes2: {
    type: [MySubschema],
    label: "My attributes2",
    optional: true,
    autoform: {
      minCount: 1
    }
  },
})

MyLargerSchema = new SimpleSchema({
  my_attributes1: {
    type: [MySubschema],
    label: "My attributes1",
    optional: true,
    autoform: {
      minCount: 1
    }
  },
  my_medium_attributes: {
    type: MyMediumSchema,
    label: "My medium attributes,
    optional: true,
  },
})

On the one hand, this solves my problems :slight_smile:

On the other hand, I would like to do this without changing the schema, ie using exclusively AutoForm components, helpers, elements. Is this possible?