-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional properties are not submitted when nested and omit data enabled #1497
Comments
@CodeGains any thoughts on why this might be happening? |
@hutch120 did you ever find a workaround for this? I'm having what I believe is the same issue as you can see with this Playground Link. I've traced it down to this line https://github.com/rjsf-team/react-jsonschema-form/blob/master/packages/core/src/components/Form.js#L164 #1419 introduced this line and may be worth looking at further. If there is an alternative approach to have a key/value field in a form with JSON Schema I'd be happy to go that route instead but this is the only one I've seen (this is new to me). |
here's a test I was writing for this: it.only("should rename formData key if key input is renamed in a nested object with omitExtraData=true and liveOmit=true", () => {
const { node, onChange } = createFormComponent({
schema: {
type: "object",
properties: {
nested: {
additionalProperties: { type: "string" }
}
}
},
formData: { nested: { key1: "value" } }
}, {omitExtraData: true, liveOmit: true});
const textNode = node.querySelector("#root_key1-key");
Simulate.blur(textNode, {
target: { value: "key1new" },
});
sinon.assert.calledWithMatch(onChange.lastCall, {
formData: { nested: { key1new: "value" } }
});
}); |
@achendrick Hi. so we applied this to a bunch of existing JSON configuration files and the config would not fit the schema correctly without using nested additional properties. So the workaround was to leave omitExtraData set to false. This is a shame because it means our saved configs are quite messy because when we do migrations, etc, they retain the old data. Anyway, it worked, so we left it. I'd be keen to revisit/test an update if it was available. |
Fix bug where additional properties are not submitted when nested and omit data enabled Fixes #1497 Co-authored-by: Ashwin Ramaswami <[email protected]>
Please re check this fix. as when we implment if-else-then in rjsf few issues arising on additionalProperties + liveOmit |
Prerequisites
Description
Additional properties are not submitted when nested and omit data enabled. This only happens when it is nested.
Steps to Reproduce
Expected behavior
Additional Properties submitted in form data.
Actual behavior
Nothing submitted.
Version
Used online playground version.
The text was updated successfully, but these errors were encountered: