Skip to content

Conversation

@DSingh0304
Copy link
Contributor

Description

This PR adds a SchemaForm component that automatically generates form UI from JSON Schema. This is a working proof-of-concept demonstrating the approach discussed in #2986.

Features

  • Basic type mapping: Converts JSON Schema types to existing form components

    • string → FormItemTextInput
    • number/integer → FormItemNumberInput
    • boolean → FormItemSwitch
    • enum → FormItemSelect
  • oneOf support: Conditional field groups based on a discriminator field

    • Example: Select "oauth" → shows OAuth fields; Select "api_key" → shows API Key fields
  • dependencies support: Conditional fields based on other field values

    • Example: Select "redis" storage → shows Redis Host/Port fields

Demo

A demo page is available at /schema_form_demo to test the functionality.

Technical Approach

  1. Zero new dependencies - Reuses existing FormItem* components
  2. Uses React Hook Form's useWatch for conditional rendering
  3. Recursive rendering for nested object schemas

Related Issue

Related to #2986

Screenshots

Screenshot from 2026-01-05 11-33-41 Screenshot from 2026-01-05 11-33-36

- Add SchemaForm component that renders forms from JSON Schema
- Support for oneOf (conditional field groups)
- Support for dependencies (conditional fields based on other values)
- Reuses existing FormItem components (TextInput, Select, Switch, NumberInput)
- Add demo page at /schema_form_demo for testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant