rjsf-team/react-jsonschema-form

$ref Support for Database or Callback Integration

Open

#4,406 创建于 2024年12月2日

在 GitHub 查看
 (2 评论) (2 反应) (0 负责人)TypeScript (13,175 star) (2,136 fork)batch import
featurehelp wanted

描述

Prerequisites

What theme are you using?

mui

Is your feature request related to a problem? Please describe.

My application is built with Supabase, and some of the enum fields need to be fetched dynamically from database tables. As far as I know, there isn't a straightforward or out-of-the-box solution for this. Based on my understanding of the documentation, the $ref expects to be linked to a property within the definition object.

If support for either callbacks or external sources (e.g., databases) could be added, it would significantly enhance the versatility, developer experience (DX), and overall ease of use of this library.

Describe the solution you'd like

A solution could include a new valueGetter property that supports an asynchronous function to fetch relevant data. The returned array/value from this function would automatically set the fetched data as the value/enum to be consumed and dynamically manage the loading state.

Describe alternatives you've considered

An inefficient workaround that requires writing a lot of code to iterate through fields, handle specific ones, and implement custom widgets. In other words, adding unnecessary complexity and excessive code just to achieve this very important feature that is needed for most modern applications.

贡献者指南