You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a JSON Schema that combines a discriminated union with null using anyOf, the form does not render the discriminated union options correctly. Instead, it only allows selecting the null option, and the expected fields for the other options are not displayed.
Expected Behavior
The form should correctly render the options from the discriminated union alongside the null option, allowing users to select any of the available types or null.
Steps To Reproduce
Use the following JSON Schema in the react-jsonschema-form playground or your environment:
Attempt to select options other than null for the components field.
Observe that only the null option is selectable, and the discriminated union options are not available.
To prove that the discriminated union is not the problem, here's the same json without combining it with the null option:
Working Json Schema
[playground](https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJjb21wb25lbnRzIjp7Im5hbWUiOiJMb2dpdGVjaCBNb3VzZSIsInByaWNlIjoxMCwidHlwZSI6InBlcmlwaGVyYWwiLCJraW5kIjoibW91c2UiLCJtYXhfZHBpIjo2MDAsImJyYW5kIjoiTG9naXRlY2gifX0sInNjaGVtYSI6eyIkZGVmcyI6eyJMb2dpdGVjaE1vdXNlIjp7ImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjpmYWxzZSwicHJvcGVydGllcyI6eyJuYW1lIjp7ImRlZmF1bHQiOiJMb2dpdGVjaCBNb3VzZSIsInRpdGxlIjoiTmFtZSIsInR5cGUiOiJzdHJpbmcifSwicHJpY2UiOnsiZGVmYXVsdCI6MTAsInRpdGxlIjoiUHJpY2UiLCJ0eXBlIjoibnVtYmVyIn0sInR5cGUiOnsiY29uc3QiOiJwZXJpcGhlcmFsIiwiZGVmYXVsdCI6InBlcmlwaGVyYWwiLCJlbnVtIjpbInBlcmlwaGVyYWwiXSwidGl0bGUiOiJUeXBlIiwidHlwZSI6InN0cmluZyJ9LCJraW5kIjp7ImNvbnN0IjoibW91c2UiLCJkZWZhdWx0IjoibW91c2UiLCJlbnVtIjpbIm1vdXNlIl0sInRpdGxlIjoiS2luZCIsInR5cGUiOiJzdHJpbmcifSwibWF4X2RwaSI6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WluYXRvciI6eyJtYXBwaW5nIjp7IkxvZ2l0ZWNoIjoiIy8kZGVmcy9Mb2dpdGVjaE1vdXNlIiwiUmF6ZXIiOiIjLyRkZWZzL1JhemVyTW91c2UifSwicHJvcGVydHlOYW1lIjoiYnJhbmQifSwib25lT2YiOlt7IiRyZWYiOiIjLyRkZWZzL0xvZ2l0ZWNoTW91c2UifSx7IiRyZWYiOiIjLyRkZWZzL1JhemVyTW91c2UifV0sInRpdGxlIjoiQXZhaWxhYmxlTW91c2VzIn19LCJyZXF1aXJlZCI6WyJjb21wb25lbnRzIl0sInRpdGxlIjoiQ29tcHV0ZXIiLCJ0eXBlIjoib2JqZWN0In0sInVpU2NoZW1hIjp7fSwidGhlbWUiOiJkZWZhdWx0IiwibGl2ZVNldHRpbmdzIjp7InNob3dFcnJvckxpc3QiOiJ0b3AiLCJleHBlcmltZW50YWxfZGVmYXVsdEZvcm1TdGF0ZUJlaGF2aW9yIjp7ImFycmF5TWluSXRlbXMiOnsicG9wdWxhdGUiOiJwb3B1bGF0ZSIsIm1lcmdlRXh0cmFEZWZhdWx0cyI6ZmFsc2V9LCJhbGxPZiI6InNraXBEZWZhdWx0cyIsImNvbnN0QXNEZWZhdWx0cyI6ImFsd2F5cyIsImVtcHR5T2JqZWN0RmllbGRzIjoicG9wdWxhdGVBbGxEZWZhdWx0cyIsIm1lcmdlRGVmYXVsdHNJbnRvRm9ybURhdGEiOiJ1c2VGb3JtRGF0YUlmUHJlc2VudCJ9fX0=)
Prerequisites
What theme are you using?
core
Version
5.x
Current Behavior
When using a JSON Schema that combines a discriminated union with null using anyOf, the form does not render the discriminated union options correctly. Instead, it only allows selecting the null option, and the expected fields for the other options are not displayed.
Expected Behavior
The form should correctly render the options from the discriminated union alongside the null option, allowing users to select any of the available types or null.
Steps To Reproduce
Failing Json Schema
playground
To prove that the
discriminated union
is not the problem, here's the same json without combining it with thenull
option:Working Json Schema
[playground](https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0Y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oZW1hIjp7fSwidGhlbWUiOiJkZWZhdWx0IiwibGl2ZVNldHRpbmdzIjp7InNob3dFcnJvckxpc3QiOiJ0b3AiLCJleHBlcmltZW50YWxfZGVmYXVsdEZvcm1TdGF0ZUJlaGF2aW9yIjp7ImFycmF5TWluSXRlbXMiOnsicG9wdWxhdGUiOiJwb3B1bGF0ZSIsIm1lcmdlRXh0cmFEZWZhdWx0cyI6ZmFsc2V9LCJhbGxPZiI6InNraXBEZWZhdWx0cyIsImNvbnN0QXNEZWZhdWx0cyI6ImFsd2F5cyIsImVtcHR5T2JqZWN0RmllbGRzIjoicG9wdWxhdGVBbGxEZWZhdWx0cyIsIm1lcmdlRGVmYXVsdHNJbnRvRm9ybURhdGEiOiJ1c2VGb3JtRGF0YUlmUHJlc2VudCJ9fX0=)Environment
Anything else?
Off-topic: I'm using
Pydantic
(version 2.9.2) to generate those Json-Schemas; here's the code:Pydantic Code
The text was updated successfully, but these errors were encountered: