How to define the min size of array in the json schema

I suppose no, at least looking to working draft the minimum is applied only for numeric values, not arrays.

5.1. Validation keywords for numeric instances (number and integer)
...
5.1.3. minimum and exclusiveMinimum

So you should be good with min/maxItems for arrays.


To set the minimum # of item in an array, use the "minItems".

See:

https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00#section-5.3.3

and

http://jsonary.com/documentation/json-schema/?section=keywords/Array%20validation

   {
   "$schema": "http://json-schema.org/draft-04/schema#",
   "title": "Product",
   "description": "A product from Acme's catalog",
   "type": "object",
   "properties": {
      ...
      "tags": {
          "type": "array",
          "items": {
              "type": "string"
          },
          "minItems": 1,
          "maxItems": 4,
          "uniqueItems": true
      }
  },
  "required": ["id", "name", "price"]
  }

It looks like draft v4 permits what you are looking for. From http://json-schema.org/example1.html:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
    ...
    "tags": {
        "type": "array",
        "items": {
            "type": "string"
        },
        "minItems": 1,
        "uniqueItems": true
    }
},
"required": ["id", "name", "price"]
}

Notice that the "tags" property is defined as an array, with a minimum number of items (1).