Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$ref Support for Database or Callback Integration #4406

Open
1 task done
aress31 opened this issue Dec 2, 2024 · 2 comments
Open
1 task done

$ref Support for Database or Callback Integration #4406

aress31 opened this issue Dec 2, 2024 · 2 comments
Labels
feature Is a feature request help wanted

Comments

@aress31
Copy link

aress31 commented Dec 2, 2024

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.

@aress31 aress31 added feature Is a feature request needs triage Initial label given, to be assigned correct labels and assigned labels Dec 2, 2024
@aress31 aress31 changed the title $ref Support for Database or Callback $ref Support for Database or Callback Integration Dec 4, 2024
@heath-freenome
Copy link
Member

@aress31 This is a huge lift and unless you plan on doing the work in a way that make this opt-in behavior then we don't expect that it will happen. Moreover, we would not support adding in anything that is not directly part of the JSON Schema specification in regards to needing the schema to have additional properties (if I understand your valueGetter remark). Feel free to join one of our weekly meetings to discuss it (see the #2417)

@heath-freenome heath-freenome added help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels Dec 6, 2024
@aress31
Copy link
Author

aress31 commented Dec 7, 2024

It's undoubtedly a significant enhancement, but implementing a valueGetter to populate enumOptions would greatly increase the library's utility. As I mentioned, many modern web applications retrieve options dynamically from various sources—databases, externally hosted files, and more. Currently, integrating such functionality into rjsf requires a considerable amount of custom code. Adding a valueGetter would streamline this process and make the library far more versatile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is a feature request help wanted
Projects
None yet
Development

No branches or pull requests

2 participants