rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.3k stars 2.19k forks source link

Possibilty to filter properties from big json schemas #4075

Open dberardo-com opened 8 months ago

dberardo-com commented 8 months ago

Prerequisites

What theme are you using?

core

What is your question?

is it possible to let rjsf know which part of a json schema to select in order to create the form ?

my use case is the following. i have got an auto generated, big json schema, like in here: https://github.com/charlypoly/graphql-to-json-schema

i want to create multiple forms based on just parts of the schema, but of course i dont want to reinvent the wheel having to extract all referenced objects from a starting property. is it possible to tell rjsf which properties to consturct a form for ?

heath-freenome commented 8 months ago

@dberardo-com unfortunately there isn't a simple way to do what you need. Especially if the different parts of the json schema that you don't want to show would cause validations errors. It IS possible to use the uiSchema to hide fields via the hidden widget but if the fields that are hidden have required data in them, then you'll have to provide a transformError function on each form to filter out the errors you don't want to see.

dberardo-com commented 8 months ago

i see, so whitelisting is not possible, only blacklisting (via hidden attribute) is currently supported ?