jsonforms icon indicating copy to clipboard operation
jsonforms copied to clipboard

Adding ‘null’ and ‘object’ type to property values for a schema

Open RhysMAdey opened this issue 10 months ago • 1 comments

Describe the bug

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?

Expected behavior

both types null and object will be applied to a properties property.

Steps to reproduce the issue

add

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

into the schema option of JSON forms

Screenshots

No response

Which Version of JSON Forms are you using?

3.4.1

Package

No response

Additional context

No response

RhysMAdey avatar Jan 16 '25 15:01 RhysMAdey