Unexpected behaviour with Retool JSON Schema form component: oneOf property in form data not being replaced

Unexpected behaviour with Retool JSON Schema Form component using oneOf object schemas. Form data is appended to and not replaced.

Minimum example required to recreate:
Using the following schema:

{
  "title": "A registration form",
  "description": "A simple form example.",
  "type": "object",
  "properties": {
    "field": {
      "oneOf": [
        {
          "title": "Lorem",
          "properties": {
            "lorem": {
              "type": "object",
              "properties": {
                "lorem": {
                  "type": "string"
                }
              }
            }
          },
          "required": [
            "lorem"
          ]
        },
        {
          "title": "Ipsum",
          "properties": {
            "ipsum": {
              "type": "object",
              "properties": {
                "ipsum": {
                  "type": "string"
                }
              }
            }
          },
          "required": [
            "ipsum"
          ]
        }
      ]
    }
  }
}

Gives the following in the react json schema form playground

Selecting the ipsum option from the drop down replaces the object in the formData

This is expected behaviour.

Retool JSON Schema Form Component

Using the above schema yields the following component:

Form data is appended to and not replaced.

Form is therefore invalid because of the extra object key in the form data, which should be fully replaced.

Hey @Edward_Rose! Unfortunately, I believe that oneOf doesn't actually validate properly in JSON Schema Forms in Retool. The currently workaround would be to build the form manually without a schema. Does this sound like a viable option for you, or are you completely blocked? Let me know either way! :slight_smile:

Hi @victoria,

I built a work around with a JS transformer to pick the correct object for my query on submit. It would be great to have consistency between the Retool form and the underlying react json schema, a bug to be fixed another day.

Glad to hear you were able to find a solution. The JSON Schema Form library is definitely not quite synced with our internal Form component and I completely understand how this is confusing - thank you for the feedback here!