react-jsonschema-form
react-jsonschema-form copied to clipboard
Invalid values when adding property with multiple possible value types (e.g. nullable ["object", "null"])
Prerequisites
- [x] I have read the documentation;
- [x] In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.
- [x] Ideally, I'm providing a sample JSFiddle or a shared playground link demonstrating the issue.
Description
Invalid form data when adding additionalProperties where the values are of multiple possible types (e.g. ["object", "null"])
Steps to Reproduce
- Open this playground link.
- Click the "+" button to add a new property to "DictProp"
- Set the
Valueproperty of the newly added value on the form.
Expected behavior
At step 2 above, either the new value in the formData should be one of the valid types (object/null). At step 3 above, the properties of newKey should not contain the characters of "New Value" expanded out into properties on the object.
Actual behavior
At step 2 above, the formData now includes an invalid property: "newKey": "New Value" that does not match the schema (the values for additional properties must be object or null, but the value added is a string:
{
"DictProp": {
"newKey": "New Value"
}
}
At step 3 above, the formData now includes the string "New Value" expanded out character-by-character as numbered properties of the object:
{
"DictProp": {
"newKey": {
"0": "N",
"1": "e",
"2": "w",
"3": " ",
"4": "V",
"5": "a",
"6": "l",
"7": "u",
"8": "e",
"Value": "X"
}
}
}
Version
3.2.1
Hello @jacqueswho , Would like to know the update on this issue. Thanks.
@Sachin-chaurasiya I will bring it up in the next meeting
@Sachin-chaurasiya I will bring it up in the next meeting
That would be great, thanks @jacqueswho
Hello @jacqueswho , Hope you are doing well, Is there any update on this issue?
Hello @jacqueswho , Hope you are doing well, Is there any update on this issue?
@Sachin-chaurasiya apologies, but work has been quite busy, not been in the last 2 meetings, also there was a public holiday. Will check on what was discussed
Hello @jacqueswho , Hope you are doing well, Is there any update on this issue?
@Sachin-chaurasiya apologies, but work has been quite busy, not been in the last 2 meetings, also there was a public holiday. Will check on what was discussed
Thanks, @jacqueswho, It would be great if you provide me with some work around for this.
@Sachin-chaurasiya Sorry it took so long. I have investigated this, had a look at the code, according to the docs, you cant specify object as a type for this. So if you look at this playground link . It works as expected, not sure what you were expecting
@Sachin-chaurasiya Sorry it took so long. I have investigated this, had a look at the code, according to the docs, you cant specify object as a type for this. So if you look at this playground link . It works as expected, not sure what you were expecting
Thanks @jacqueswho , I will have a look.
@Sachin-chaurasiya Sorry it took so long. I have investigated this, had a look at the code, according to the docs, you cant specify object as a type for this. So if you look at this playground link . It works as expected, not sure what you were expecting
Hello @jacqueswho , How can we get rid of this default values in additional properties?

@Sachin-chaurasiya Sorry it took so long. I have investigated this, had a look at the code, according to the docs, you cant specify object as a type for this. So if you look at this playground link . It works as expected, not sure what you were expecting
Hello @jacqueswho , How can we get rid of this default values in additional properties?
Hi @jacqueswho Is there a way of hack that will allow us to remove this values to be populated?
Hi @jacqueswho
I have investigated this and figured out that we have Hardcoded "newKey" here
Can we provide an option to override it?
The same goes for value too, look here
We need some way to override these values as adding a new field renders these hardcoded strings.
Any help or hack is appriciated
This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.
This issue was closed because of lack of recent activity. Reopen if you still need assistance.