Skip to content

Support oneOf nested in an array #1213

@johnmorrell

Description

@johnmorrell

Is your feature request related to a problem? Please describe.
I have a schema with oneOf nested in an array and have been unable to render it. I have attempted the following simplified example:

Schema:

{
   "$schema":"http://json-schema.org/draft-07/schema#",
   "properties":{
      "oneOfArray":{
         "type":"array",
         "items":{
            "$ref":"#/definitions/addressOrUser"
         }
      }
   },
   "definitions":{
      "addressOrUser":{
         "oneOf":[
            {
               "$ref":"#/definitions/address"
            },
            {
               "$ref":"#/definitions/user"
            }
         ]
      },
      "address":{
         "type":"object",
         "properties":{
            "street_address":{
               "type":"string"
            },
            "city":{
               "type":"string"
            },
            "state":{
               "type":"string"
            }
         },
         "required":[
            "street_address",
            "city",
            "state"
         ]
      },
      "user":{
         "type":"object",
         "properties":{
            "name":{
               "type":"string"
            },
            "mail":{
               "type":"string"
            }
         },
         "required":[
            "name",
            "mail"
         ]
      }
   }
}

UISchema:

{
   "type":"VerticalLayout",
   "elements":[
      {
         "type":"Control",
         "scope":"#/properties/oneOfArray"
      }
   ]
}

Describe the solution you'd like
Automatic rendering or ability to specify UISchema.

Describe alternatives you've considered
I have attempted solving this with inline UISchema as per #1198

Describe for which setup you like to have the improvement
Framework: React
RendererSet: Material

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions