Skip to content

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

Open
@RhysMAdey

Description

@RhysMAdey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions