react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

Schema dependency Failed prop type ERROR

Open marvz73 opened this issue 6 years ago • 6 comments

Prerequisites

Description

When using schema dependencies, it causes an error.

Steps to Reproduce

var schema = {
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "credit_card": { "type": "string" }
  },
  "required": ["name"],
  "dependencies": {
    "credit_card": {
      "properties": {
        "billing_address": { "type": "string" }
      }
    }
  }
}

Actual behavior

When I try to enter a value in dependency field this error shows up:

warning.js:33 Warning: Failed prop type: The prop id is marked as required in BaseInput, but its value is undefined. in BaseInput (created by TextWidget) in TextWidget (created by Unknown) in Unknown (created by StringField) in StringField (created by SchemaField) in div (created by DefaultTemplate) in DefaultTemplate (created by SchemaField) in SchemaField (created by ObjectField) in fieldset (created by DefaultObjectFieldTemplate) in DefaultObjectFieldTemplate (created by ObjectField) in ObjectField (created by SchemaField) in div (created by DefaultTemplate) in DefaultTemplate (created by SchemaField) in SchemaField (created by Form) in form (created by Form) in Form

Version

1.0.0

marvz73 avatar Nov 17 '17 10:11 marvz73

Yeah, having the same issue. The problem seems to be that an id is not being generated for each of the new fields that are being added as part of the dependency schema.

redixhumayun avatar Nov 27 '17 09:11 redixhumayun

Hello, same issue here. How do you manage to manually add the id ?

desirelabs avatar Nov 28 '17 10:11 desirelabs

Hey, submitted a PR for this, #778 Please take a look. This is a very important feature for us, and we need it back as soon as possible

redixhumayun avatar Nov 29 '17 04:11 redixhumayun

Hi, somebody found how fix that issue?

When I use the < Form />, its works for me, but I'm using SchemaField, instead of Form, so can't find a way how to fix The prop id is marked as required in BaseInput, but its value is undefined.

heilgar avatar Dec 22 '17 21:12 heilgar

Any update on this issue? I am having a similar issue with dynamic schema dependency. The schema is not getting modified with the change of formData.

anudeesh avatar May 18 '18 19:05 anudeesh

Hi @anudeesh, I found some workaround, have a look on Form component at my form-builder repo

heilgar avatar May 21 '18 08:05 heilgar