Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274:
URL:
https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4249428482
> Thank you for the significant effort on the SchemaForm component. The
component architecture is well-designed with a clean recursive rendering
pattern, and the test coverage is quite thorough (50 tests). The overall
direction is solid.
>
> However, there are several blocking issues that need to be resolved before
merging:
>
> 1. Dependency downgrades: This PR downgrades several TanStack packages
to significantly older versions (e.g., react-router from ^1.168.3 to ^1.116.0).
This is likely due to developing on an older fork of master. Please rebase onto
the latest master and keep upstream dependency versions, only adding the new
dependencies required by SchemaForm (ajv, vitest, testing-library, etc.).
>
> 2. producer.ts regression: The modification to the pipeProduce
function replaces produceRestoreEmptyPlugins with a two-pass marker approach,
which drops the discovery_args: {} restoration logic. This change is unrelated
to SchemaForm and introduces a regression. Please revert all changes to
producer.ts.
>
> 3. Unrelated .gitignore entries: The added .gemini/artifacts/ and
jsonschema-poc/ entries are personal development artifacts and should not be
committed to the project's .gitignore. Please remove these entries.
>
> 4. Demo route in production: schema_form_demo is registered as a
production route and will appear in release builds. Please either remove it or
make it available only in development mode.
>
>
> Additional suggestions (non-blocking):
>
> * OneOfFields and AnyOfFields are nearly identical (~150 lines of
duplication). Consider extracting a shared VariantFields component.
>
> * findDiscriminators only recognizes const-based discriminators.
Consider extending it to support single-value enum as well.
>
> * collectAllPaths does not handle array items or patternProperties
sub-paths, which may cause missed unregistrations on branch switching.
>
> * formatLabel renders "oauth" as "OAUTH" while the standard form is
"OAuth".
Thanks for the review! @Baoyuantop The blockers are fixed:
1. **Dependencies** - Rebased onto latest master, all TanStack packages now
aligned
2. **producer.ts** - Verified `discovery_args` restoration is intact
3. **.gitignore** - Confirmed clean, no personal artifacts tracked
4. **Demo route** - Deleted `schema_form_demo.tsx` and demo utilities
I'll will make further changes in the PR so that it can be merge ready and
will update you in a while.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
Baoyuantop commented on PR #3274:
URL:
https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4248754264
Thank you for the significant effort on the SchemaForm component. The
component architecture is well-designed with a clean recursive rendering
pattern, and the test coverage is quite thorough (50 tests). The overall
direction is solid.
However, there are several blocking issues that need to be resolved before
merging:
1. Dependency downgrades: This PR downgrades several TanStack packages to
significantly older versions (e.g., react-router from ^1.168.3 to ^1.116.0).
This is likely due to developing on an older fork of master. Please rebase onto
the latest master and keep upstream dependency versions, only adding the new
dependencies required by SchemaForm (ajv, vitest, testing-library, etc.).
2. producer.ts regression: The modification to the pipeProduce function
replaces produceRestoreEmptyPlugins with a two-pass marker approach, which
drops the discovery_args: {} restoration logic. This change is unrelated to
SchemaForm and introduces a regression. Please revert all changes to
producer.ts.
3. Unrelated .gitignore entries: The added .gemini/artifacts/ and
jsonschema-poc/ entries are personal development artifacts and should not be
committed to the project's .gitignore. Please remove these entries.
4. Demo route in production: schema_form_demo is registered as a production
route and will appear in release builds. Please either remove it or make it
available only in development mode.
Additional suggestions (non-blocking):
- OneOfFields and AnyOfFields are nearly identical (~150 lines of
duplication). Consider extracting a shared VariantFields component.
- findDiscriminators only recognizes const-based discriminators. Consider
extending it to support single-value enum as well.
- collectAllPaths does not handle array items or patternProperties
sub-paths, which may cause missed unregistrations on branch switching.
- formatLabel renders "oauth" as "OAUTH" while the standard form is "OAuth".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4118878971 The error was caused by duplicated package keys, fixed in [84aab84](https://github.com/apache/apisix-dashboard/pull/3274/commits/84aab84e7bfa3ae1efc5d03fb25207384abb8435) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4118292051 - Optimized useWatch: Narrowed subscriptions in IfThenElseFields to only watch fields referenced in the if condition. - Recursive Cleanup: Added a collectAllPaths helper to ensure full subtree unregistration for nested objects/arrays. - Expanded Test Suite: Added 3 new test suites (totaling 50 tests) covering rapid branch switching, nested cleanup, and validation error purging. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4118004091 This PR has been updated and these are the updates: ### 1. Alignment on Correctness (Form State Cleanup) I have implemented a robust state management system using `unregister()` within the recursive `SchemaField` dispatcher. * **The Fix:** When a user switches branches (e.g., in a `oneOf` or `anyOf` selection), all stale/ghost values from the non-active branches are now automatically removed from the form state. * **Submit Payload Consistency:** This ensures that the final payload sent to the APISIX backend strictly adheres to the schema of the **currently selected** plugin variant, preventing hidden validation errors from inactive fields. ### 2. Verifiable Deliverables I’ve updated my proposal to bind each phase to these deliverables: * **Test Suite:** Expanded to **47 passing tests** (vitest) covering conditional branch switching and recursive validation. * **Live Demo:** Updated the `schema_form_demo` route with a "Live Form Data" monitor, allowing maintainers to visually verify that the payload is cleaned up in real-time as they toggle options. * **Pass Criteria:** 100% test pass rate + zero-warning `pnpm lint` build (verified with `--max-warnings=0`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4117936808 > > > Hi @DSingh0304, > > > I tested the SchemaForm demo and was able to reproduce the issue where switching between schema branches (oneOf / anyOf / if-then-else) retains stale field values in the form state. > > > I worked on a fix for this by implementing branch-aware cleanup inside SchemaForm. Instead of relying only on `shouldUnregister`, the solution explicitly unregisters fields that are no longer part of the active schema branch. > > > ### Solution > > > ``` > > > * Tracks active schema branch paths > > > > > > * Automatically calls `unregister` on fields from previous branches > > > > > > * Works for: > > > > > > * oneOf > > > * anyOf > > > * if/then/else > > > * dependencies > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ### Testing > > > ``` > > > * Verified via `/schema_form_demo` > > > > > > * Switching branches correctly removes stale values > > > > > > * No regression in existing behavior > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I’d be happy to open a PR or contribute to the existing one if this approach aligns with the project direction. Please let me know your thoughts. > > > > > > Hey @Jaswanth-arjun I have fixed that issue in these recent commits, thank you for reporting the issue and i have added the test for it as well. I will update the PR description, proposal and screenshot and video proof as well. > > Thanks for the update! @DSingh0304 > > I also worked on this issue and implemented a similar branch-cleanup approach with additional testing locally. > > I’d be happy to help further improve this PR. Possible areas I can contribute: > > * Additional edge-case testing (nested schemas, repeated switching) > > * Performance improvements for large schemas > > * UI/UX improvements for generated forms > > * Documentation improvements for SchemaForm behavior > > > Please let me know if I can help with anything here. Yes sure I will let you know if I need any help. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
Jaswanth-arjun commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4117892682 > > Hi @DSingh0304, > > I tested the SchemaForm demo and was able to reproduce the issue where switching between schema branches (oneOf / anyOf / if-then-else) retains stale field values in the form state. > > I worked on a fix for this by implementing branch-aware cleanup inside SchemaForm. Instead of relying only on `shouldUnregister`, the solution explicitly unregisters fields that are no longer part of the active schema branch. > > ### Solution > > ``` > > * Tracks active schema branch paths > > > > * Automatically calls `unregister` on fields from previous branches > > > > * Works for: > > > > * oneOf > > * anyOf > > * if/then/else > > * dependencies > > ``` > > > > > > > > > > > > > > > > > > > > > > > > ### Testing > > ``` > > * Verified via `/schema_form_demo` > > > > * Switching branches correctly removes stale values > > > > * No regression in existing behavior > > ``` > > > > > > > > > > > > > > > > > > > > > > > > I’d be happy to open a PR or contribute to the existing one if this approach aligns with the project direction. Please let me know your thoughts. > > Hey @Jaswanth-arjun I have fixed that issue in these recent commits, thank you for reporting the issue and i have added the test for it as well. I will update the PR description, proposal and screenshot and video proof as well. Thanks for the update! @DSingh0304 I also worked on this issue and implemented a similar branch-cleanup approach with additional testing locally. I’d be happy to help further improve this PR. Possible areas I can contribute: - Additional edge-case testing (nested schemas, repeated switching) - Performance improvements for large schemas - UI/UX improvements for generated forms - Documentation improvements for SchemaForm behavior Please let me know if I can help with anything here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4117867886 > Hi @DSingh0304, > > I tested the SchemaForm demo and was able to reproduce the issue where switching between schema branches (oneOf / anyOf / if-then-else) retains stale field values in the form state. > > I worked on a fix for this by implementing branch-aware cleanup inside SchemaForm. Instead of relying only on `shouldUnregister`, the solution explicitly unregisters fields that are no longer part of the active schema branch. > ### Solution > > * Tracks active schema branch paths > > * Automatically calls `unregister` on fields from previous branches > > * Works for: > > * oneOf > * anyOf > * if/then/else > * dependencies > > > ### Testing > > * Verified via `/schema_form_demo` > > * Switching branches correctly removes stale values > > * No regression in existing behavior > > > I’d be happy to open a PR or contribute to the existing one if this approach aligns with the project direction. Please let me know your thoughts. Hey @Jaswanth-arjun I have fixed that issue in these recent commits, thank you for reporting the issue and i have added the test for it as well. I will update the PR description, proposal and screenshot and video proof as well. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
Jaswanth-arjun commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4117561035 Hi @DSingh0304 , I tested the SchemaForm demo and noticed that when switching between oneOf/anyOf options, previously rendered fields remain in the form state. I’d like to help fix this issue. My initial thought is to use `shouldUnregister: true` in react-hook-form to clean up unmounted fields. Please let me know if this approach works, I’d be happy to contribute a fix. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4004790690 Hi @suryaparua-official I have been testing the form myself and I came across these issue. I will resolve them soon, I have been busy. Thank you for pointing the issues out. They will be resolved soon. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
suryaparua-official commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4004749857 I also tested enabling `shouldUnregister: true` in `useForm` during local testing, and it removed the stale `oneOf` fields when switching variants. It seems this behavior may be related to React Hook Form keeping unmounted fields in form state by default. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
suryaparua-official commented on PR #3274:
URL:
https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4004665547
Hi @DSingh0304
I tested the SchemaForm demo locally from this PR branch.
Steps to reproduce:
1. Navigate to `/ui/schema_form_demo`
2. Select `auth_type = oauth`
3. Fill the OAuth fields
4. Change `auth_type` to `api_key`
Expected behavior:
When switching to `api_key`, OAuth-related fields should be removed from the
form state.
Actual behavior:
The OAuth fields remain in the form data even after switching to `api_key`.
Example form data after switching:
{
"auth_type": "api_key",
"oauth_client_id": "...",
"oauth_client_secret": "..."
}
It seems the previous `oneOf` branch values remain in the react-hook-form
state.
Screenshot attached for reference.
https://github.com/user-attachments/assets/df7fe05f-2042-428a-b5e6-639ca6e139c1";
/>
https://github.com/user-attachments/assets/48c95eba-e481-499b-a9bf-e78a10300ab7";
/>
https://github.com/user-attachments/assets/7f632d02-7c32-4eb9-a3ba-3621a1eb5f35";
/>
https://github.com/user-attachments/assets/1e9cd715-c5b4-4788-a94d-9d71d65c06c3";
/>
https://github.com/user-attachments/assets/235ab79e-46c6-441e-a495-83195dde8c37";
/>
https://github.com/user-attachments/assets/85f1ed72-483c-4447-bfd2-cfa4188b2b00";
/>
Let me know if you would like me to explore a potential fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] GSOC 26 Proof of Concept: add SchemaForm component for JSON Schema to Form UI [apisix-dashboard]
DSingh0304 commented on PR #3274: URL: https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-3991775175 Hi maintainers! I've submitted this PoC PR for this issue as part of my GSoC 2026 application. The branch adds anyOf, if/then/else, and encrypt_fields support to the existing SchemaForm, with 43 passing tests and an interactive demo at /schema_form_demo. A developer guide is included at schema-form.md. Happy to discuss any implementation decisions or adjust based on feedback. Thank you! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
