remoteoss / json-schema-form

https://json-schema-form.vercel.app
MIT License
85 stars 6 forks source link

fix(select): support string type #54

Closed joeynimu closed 11 months ago

joeynimu commented 11 months ago

Description

This MR adds support for select field types with a string type option.

Usecase

When working with select fields, at times you might want the user to either pick an existing option or create an option on the fly.

Usage

{
...
  "department": {
      "title": "Department",
      "type": "string",
      "description": "Select a department or create one",
      "x-jsf-presentation": {
        "inputType": "select"
      },
      "oneOf": [
        { "const": "engineering_slug", "title": "Engineering" },
        { "const": "marketing_slug", "title": "Marketing" },
        { "const": "sales_slug", "title": "Sales" },
        { "type": "string", "title": "{Create another}" }
      ]
    },
 ...
}