React-jsonschema-form: Error when nullable array is null

Created on 8 Jul 2019  路  5Comments  路  Source: rjsf-team/react-jsonschema-form

Prerequisites

Description

Unrecoverable error when nullable array is null
This is similar to #1300 however this issue specifically mentions nullable array type without default value

Steps to Reproduce

  1. Check console in playground link

Expected behavior

Empty array widget should render

Actual behavior

Unrecoverable error

Version

1.6.1

bug

Most helpful comment

Also experiencing this problem. Proper JSON schema should allow this to be null or any array. I have tons of JSON files that have their field set to "null" but some have an array there. If I pull in the former, I get an error and it crashes.

All 5 comments

Would it be possible for you to add the JSONSchema/UISchema/formData values from your playground example? Your example crashes in the same way as an issue I'm currently observing, but I'm not sure if it is for the same reason (null form data for an array type field should probably be converted to an empty list) since the playground link fails to render. I want to fix the issue and I don't want to open a PR for your issue that addresses my problem and not yours. Thanks!

@amy-keibler

You can find the values by doing atob("eyJmb3JtRGF0YSI6eyJyZXF1ZXN0IjpudWxsfSwic2NoZW1hIjp7InR5cGUiOiJvYmplY3QiLCJwcm9wZXJ0aWVzIjp7InJlcXVlc3QiOnsidHlwZSI6WyJhcnJheSIsIm51bGwiXSwiaXRlbXMiOnsidHlwZSI6InN0cmluZyJ9fX19LCJ1aVNjaGVtYSI6e319")

to get


{"formData":{"request":null},"schema":{"type":"object","properties":{"request":{"type":["array","null"],"items":{"type":"string"}}}},"uiSchema":{}}

Also experiencing this problem. Proper JSON schema should allow this to be null or any array. I have tons of JSON files that have their field set to "null" but some have an array there. If I pull in the former, I get an error and it crashes.

also was able to reproduce this problem with the following data -

formData:

{ "tags": null }

schema:

{
  "type": "object",
  "properties": {
    "tags": {
      "type": [
        "array",
        "null"
      ],
      "title": "Tags",
      "items": {
        "type": "string"
      }
    }
  }
}

UI schema:

{
  "ui:options": {
    "orderable": false
  },
  "ui:emptyValue": []
}

in addition, seems like perhaps the form doesn't recognize null as a signal to apply the emptyValue UI property?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MedinaGitHub picture MedinaGitHub  路  3Comments

mammad2c picture mammad2c  路  3Comments

jabaren picture jabaren  路  3Comments

mfulton26 picture mfulton26  路  3Comments

j-zimnowoda picture j-zimnowoda  路  3Comments