DSingh0304 commented on issue #2986:
URL: 
https://github.com/apache/apisix-dashboard/issues/2986#issuecomment-3694046053

   Thanks @Baoyuantop! You're absolutely right that `oneOf`/`anyOf` and 
dependencies are the critical challenges.
   
   I've created a proof-of-concept to demonstrate how a Custom Adapter can 
handle these cases efficiently:
   
   **POC Structure:**
   - Sample schema with `oneOf` (OAuth vs API Key authentication)
   - Sample schema with `dependencies` (Redis config only shows if 
storage_type=redis)
   - Core adapter logic showing JSON Schema → Mantine component mapping
   
   **Key Finding:**
   Both `oneOf` and `dependencies` can be handled cleanly using React Hook 
Form's `watch()` function for conditional rendering:
   
   ```typescript
   // oneOf example
   const authType = watch('auth_type');
   {authType === 'oauth' && <OAuthFieldsGroup />}
   {authType === 'api_key' && <APIKeyFieldsGroup />}
   
   // dependencies example  
   const storageType = watch('storage_type');
   {storageType === 'redis' && <RedisConfigFields />}
   ```
   
   **Bundle Impact:**
   - Custom adapter logic: ~2-3 kB
   - AJV (validation): ~20 kB
   - **Total: ~23 kB** (vs react-jsonschema-form's 69 kB)
   
   **Performance Strategy:**
   - Use React.memo for recursive components
   - Lazy render complex nested schemas
   - Memoize schema parsing results
   
   I can share the POC files if helpful, or proceed with building a live demo 
using an actual APISIX plugin schema. What would be most useful?
   


-- 
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]

Reply via email to