feat(schema-form): add basic JSON schema parser utility#3328
feat(schema-form): add basic JSON schema parser utility#3328ShreyasGhodke wants to merge 1 commit intoapache:masterfrom
Conversation
|
Hi maintainers, I’m exploring contributions around schema-driven plugin configuration forms for the dashboard. This PR adds a small utility that parses JSON Schema properties into a structure that can later be used for dynamic form rendering. I’d really appreciate any feedback or suggestions for improving this approach. Thank you! |
|
Hi @ShreyasGhodke, thank you for your contribution. Since this is just a utility function, I suggest marking the PR as a draft for now. A single function doesn’t tell us much on its own, so please flesh out your technical proposal further. |
|
Hi @Baoyuantop Background / ProblemMany plugins in Apache APISIX already define their configuration using JSON Schema. However, in the dashboard UI, plugin configuration forms are often created manually. This means:
Since the plugin schemas already contain structured metadata about configuration parameters, it may be possible for the dashboard to use that schema to dynamically generate configuration forms. GoalThe goal of this work is to explore a schema-driven approach where the dashboard can automatically generate plugin configuration forms from plugin JSON schemas. This would allow:
The utility function introduced in this PR is intended as an early step toward parsing JSON Schema properties into a format that the frontend can later use for dynamic form rendering. Proposed ArchitectureThe high-level idea is to introduce a translation layer that converts plugin JSON schemas into a form-friendly structure. Conceptual flow: APISIX Plugin Schema 1. Schema Parser UtilityThe utility introduced in this PR focuses on parsing JSON Schema properties and extracting key attributes such as:
This parsed structure can then be used by the UI to determine which form components should be rendered. 2. Intermediate Form SchemaInstead of using raw JSON schema directly in the UI, the parser would generate a simplified intermediate structure. For example: Example JSON Schema: { Parsed structure: [ This structure would make it easier for the frontend to render dynamic forms. 3. SchemaForm ComponentIn the next stage, a reusable SchemaForm component could be introduced in the dashboard UI that takes the parsed schema and renders form components dynamically. Example mapping could include:
4. Plugin Configuration IntegrationOnce the schema parser and SchemaForm component are in place, the plugin configuration page could load the plugin schema and dynamically render the form fields. This would allow plugin configuration forms to adapt automatically when schemas evolve. Potential Benefits
Future WorkIf this direction aligns with the project goals, possible next steps could include:
FeedbackSince I’m still exploring the dashboard architecture, I would appreciate feedback from maintainers on whether this schema-driven approach would align with the long-term direction of the dashboard. If this direction makes sense, I can continue refining the parser utility and gradually move toward integrating it with the UI components. Thank you for the guidance! -SG |
Why submit this pull request?
What changes will this PR take into?
This PR introduces a basic utility to parse JSON Schema definitions
into a structure suitable for rendering dynamic configuration forms
in the APISIX Dashboard.
The parser extracts:
This can be used as a foundation for implementing a reusable SchemaForm
component that renders plugin configuration forms directly from JSON Schema.
Related issues
N/A
Checklist: