Description
APISIX plugins ship JSON Schema definitions for their configuration. The Dashboard currently relies on a raw JSON/Monaco editor for plugin config. If the Dashboard can render plugin configuration forms directly from JSON Schema, developer experience improves significantly and manual UI maintenance per plugin is eliminated.
Motivation
- 150+ plugins, each with unique config schemas — maintaining hand-coded forms is unsustainable.
- The Admin API already exposes full JSON Schema at
GET /apisix/admin/schema/plugins/{name}.
- The new Dashboard (React 19 + Mantine 8 + react-hook-form + zod) has the right foundation but lacks a schema-to-form bridge.
Deliverables
Must-have (P0)
- Reusable
SchemaForm component that accepts a JSON Schema object and renders a complete form.
- Widget mapping for basic types:
string → TextInput, number/integer → NumberInput, boolean → Switch, object → nested fieldset, array → repeatable field group.
enum support → Select dropdown.
default values pre-populated, required fields marked/enforced.
- Basic constraints:
minimum/maximum, minLength/maxLength, pattern, exclusiveMinimum, minItems/maxItems.
oneOf support — selector to choose a variant, render corresponding fields.
dependencies / conditional fields — show/hide fields based on other field values.
if/then/else conditional sub-schema rendering (used heavily: limit-conn policy→redis, jwt-auth algorithm→public_key).
- Validation via AJV against the original JSON Schema, with inline error display.
encrypt_fields meta → render as password inputs.
Should-have (P1)
anyOf support (select + render).
patternProperties support (dynamic key-value editor).
- Fallback to Monaco JSON editor for unrecognized/complex schema portions.
- Schema-to-widget override registry (custom widget for specific plugin fields).
Nice-to-have (P2)
allOf merging.
$ref / $defs resolution.
- Read-only/disabled mode for viewing existing config.
Non-goals
- Schema authoring/editing in the UI.
- Modifying APISIX core Lua schema definitions.
Technical Notes
- Schemas are fetched at runtime from Admin API; no build-time schema bundling needed.
- Existing
src/components/form/ widgets should be reused/wrapped.
- Validation: AJV for schema validation, bridge errors to react-hook-form
setError.
- APISIX-specific non-standard keys (
encrypt_fields, _meta) need explicit handling.
APISIX Plugin Schema Patterns to Support
| Pattern |
Example Plugins |
oneOf (top-level required alternatives) |
limit-conn, limit-count |
oneOf (field-level type union) |
limit-conn (conn) |
dependencies + oneOf |
jwt-auth consumer schema |
dependencies + not (mutual exclusion) |
response-rewrite |
if/then/else |
limit-conn, openid-connect, ai-proxy |
anyOf |
schema_def.lua id_schema, ai-proxy-multi |
enum |
Ubiquitous |
patternProperties |
ai-proxy auth_schema, labels_def |
Nested object |
Nearly all plugins |
array of objects |
traffic-split, health checker |
Related
Description
APISIX plugins ship JSON Schema definitions for their configuration. The Dashboard currently relies on a raw JSON/Monaco editor for plugin config. If the Dashboard can render plugin configuration forms directly from JSON Schema, developer experience improves significantly and manual UI maintenance per plugin is eliminated.
Motivation
GET /apisix/admin/schema/plugins/{name}.Deliverables
Must-have (P0)
SchemaFormcomponent that accepts a JSON Schema object and renders a complete form.string→ TextInput,number/integer→ NumberInput,boolean→ Switch,object→ nested fieldset,array→ repeatable field group.enumsupport → Select dropdown.defaultvalues pre-populated,requiredfields marked/enforced.minimum/maximum,minLength/maxLength,pattern,exclusiveMinimum,minItems/maxItems.oneOfsupport — selector to choose a variant, render corresponding fields.dependencies/ conditional fields — show/hide fields based on other field values.if/then/elseconditional sub-schema rendering (used heavily: limit-conn policy→redis, jwt-auth algorithm→public_key).encrypt_fieldsmeta → render as password inputs.Should-have (P1)
anyOfsupport (select + render).patternPropertiessupport (dynamic key-value editor).Nice-to-have (P2)
allOfmerging.$ref/$defsresolution.Non-goals
Technical Notes
src/components/form/widgets should be reused/wrapped.setError.encrypt_fields,_meta) need explicit handling.APISIX Plugin Schema Patterns to Support
oneOf(top-level required alternatives)limit-conn,limit-countoneOf(field-level type union)limit-conn(conn)dependencies+oneOfjwt-authconsumer schemadependencies+not(mutual exclusion)response-rewriteif/then/elselimit-conn,openid-connect,ai-proxyanyOfschema_def.luaid_schema,ai-proxy-multienumpatternPropertiesai-proxyauth_schema,labels_defobjectarrayof objectstraffic-split, health checkerRelated
apisix/admin/plugins.luaapisix/schema_def.lua@juzhiyuan @nic-chen @LiteSun @liuxiran @bzp2010