-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Prerequisites
- I have read the documentation
What theme are you using?
shadcn
What is your question?
Hello,
I have a specific use-case where my nullable types are represented with an anyOf but do not want to render them as a drop-down with two options (null, string).
For context, I am using FastAPI to generate an OpenAPI/JSONSchema specification for my backend API. Using FastAPI, Nullable/Optional properties are generated into JSONSchema as below (playground):
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Name",
"description": "A name of a user"
}I understand that react-jsonschema-form is expecting nullable types to use an array (in order to render a single textbox) as below (playground):
"name": {
"type": [ "string", "null" ],
"title": "Name",
"description": "A name of a user"
}Is there any way to configure react-jsonschema-form for the first case to render only a single text box? I see this as a specific case where there are only two options in an anyOf/oneOf property, and one of those options is null.
Any help would be appreciated!