Adding 'null' and 'object' type to property values for a schema

Hi,

I am trying to set a ‘type: [‘null’, ‘object’]’ for a schema item with the below code as an example:

schema={{
     type: 'object',
     properties: {
          name: {
               type: 'string',
               description: 'Name example'
          },
          geometry: {
               type: ['null', 'object'],
               properties: {
                    shape: {
                         type: 'string'
                         description: 'Example geometry shape property'
                    },
                    etc........
               }
          }
     }
}}

When I put this schema into my code it kills my app. Adding in type: 'object' it works fine.

Is it allowed to have type: ['null', 'object'] as I have done in the geometry section above?

Hi @RhysA,

This is a bug in JSON Forms. The UI Schema generator when invoked in the object renderer on geometry will produce a Control which refers to #, i.e. geometry itself. Therefore the object renderer is invoked again, generating the same UI Schema again etc. etc. resulting in an endless render nesting.

The UI Schema generator needs to be fixed to properly handle the case of a multi-type object.

If you like you can open an issue in the main repository for this. Feel free to also contribute a fix if you like.

Fab thank you, and thank you for the speedy response!