Handle props that are nullable and have an enum

Created on 2 October 2024, 7 months ago

Problem/Motivation

Imagine a property like this:

    my_property:
      type: ['string', 'null']
      enum:
        - 'one'
        - 'two'
        - 'three'
        - null

This will lead to an error like the following:

TypeError: SchemaForms\Drupal\FormGeneratorDrupal::SchemaForms\Drupal{closure}(): Argument #2 ($opt) must be of type string, null given in SchemaForms\Drupal\FormGeneratorDrupal->SchemaForms\Drupal{closure}() (line 497 of /var/www/html/vendor/e0ipso/schema-forms/src/Drupal/FormGeneratorDrupal.php).

This may only be fixable in schema-forms-php. I have reported it there:

https://github.com/e0ipso/schema-forms-php/issues/40

Proposed resolution

Support nullable enum props.

Remaining tasks

Figure out how to do it. Implement.

User interface changes

Additional UI for null values.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024