ngx-schema-form icon indicating copy to clipboard operation
ngx-schema-form copied to clipboard

Error messages not populating in fields if it is part of array widget

Open rockstarjindal opened this issue 6 years ago • 1 comments

Hi,

I have an array widget with two fields, a string and an integer.

"asins": {
    "type": "array",
    "items": {
    "type": "object",
    "properties": {
      "asinId": {
        "type": "string",
        "description": "ASIN ID",
        "minLength": 10,
        "maxLength": 10,
        "widget": "asin"
      },
      "asinQuantity": {
        "type": "integer",
        "description": "ASIN Quantity",
        "minimum": 1000
      }
    }
  }
},

On the input form, after clicking on add button and writing invalid in integer field e.g. 10 where the minimum is 1000, does not populate error messages.

screen shot 2018-07-20 at 8 41 10 am

In the above screenshot where I've logged the IntegerWidget object, you can see that minimum is set to 1000, value is 10 but the error messages array is empty.

rockstarjindal avatar Jul 20 '18 15:07 rockstarjindal

I don't know if anything has been tacitly fixed, but I have created the following demo for you:

https://makinacorpus.github.io/ngx-schema-form/dist/ngx-schema-form/?https%3A%2F%2Fgist.githubusercontent.com%2FWhileTrueEndWhile%2Fd562e2f19eaf0ed19cc3e151866e87b5%2Fraw%2F8890c3a0011cf7e99aa00e2ce798b8c0375589e5%2Fasins.schema.json

If you look into the browser log (after typing), you can see this error:

ERRORS [
  {
    "code": "MINIMUM",
    "params": [
      10,
      1000
    ],
    "message": "Value 10 is less than minimum 1000",
    "path": "#/asins/0/asinQuantity",
    "description": "ASIN Quantity"
  }
]

Possibly the behavior differs between the versions...

WhileTrueEndWhile avatar Jul 26 '18 10:07 WhileTrueEndWhile