react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

NEW: RJSF version 5 beta released

Open heath-freenome opened this issue 3 years ago • 14 comments

Here is the 5.x migration guide

Any and all feedback/issues are appreciated

heath-freenome avatar Jul 22 '22 15:07 heath-freenome

Hi, is there any time estimation when the new major will be released at least with alpha flag? Thnx!

AntonPuko avatar Jul 27 '22 15:07 AntonPuko

No promises, but best guess is beta in mid-August

heath-freenome avatar Jul 27 '22 17:07 heath-freenome

@heath-freenome sounds great, is mid-august still a reasonable possibility for v5?

benjdlambert avatar Aug 10 '22 13:08 benjdlambert

@heath-freenome sounds great, is mid-august still a reasonable possibility for v5?

I'm shooting for releasing 5.0.0-beta.1 before the end of the month. Just wrapping up the documentation and a few small fixes

heath-freenome avatar Aug 22 '22 17:08 heath-freenome

@heath-freenome awesome - sounds great! Thanks!

benjdlambert avatar Aug 23 '22 08:08 benjdlambert

congratulation on the release. I'm getting the following error when installing 5.0.0-beta.2: Module not found: Can't resolve '@rjsf/core/dist/components/fields/ArrayField' Apparently, the typescript types are generated but no js files image

kikonejacob avatar Aug 30 '22 00:08 kikonejacob

Can you give me an expanded context on where you are seeing this error (in other words what is trying to import from that directory location)? All of the source code was rolled up into the base directory *.js files... The *.d.ts files weren't rolled up, but I'm leaning towards doing that as well in the beta.3 release

Screen Shot 2022-08-29 at 10 26 33 PM

heath-freenome avatar Aug 30 '22 05:08 heath-freenome

u give me an expanded context on where you are seeing this error (in other words what is trying to import from that directory location)? All of the source code was rolled up into the b

Sounds good. I was getting the error when trying to import ArrayField.

import ArrayField from '@rjsf/core/dist/components/fields/ArrayField';

kikonejacob avatar Aug 30 '22 18:08 kikonejacob

What are you hoping to do by importing ArrayField? Are you trying to override it or something?

heath-freenome avatar Aug 30 '22 18:08 heath-freenome

What are you hoping to do by importing ArrayField? Are you trying to override it or something?

Yes. I have a use case where I override ArrayField when needed and just mount ArrayField when not needed. I think the component folder needs to be exposed. UISchema is great but there are use cases where we may need more control.

kikonejacob avatar Aug 30 '22 19:08 kikonejacob

Yes. I have a use case where I override ArrayField when needed and just mount ArrayField when not needed. I think the component folder needs to be exposed. UISchema is great but there are use cases where we may need more control.

Can you explain your use case? Several more components of ArrayField were exposed in the v5 beta as templates. Maybe your use case has been simplified by those changes?

heath-freenome avatar Aug 30 '22 20:08 heath-freenome

Yes. I have a use case where I override ArrayField when needed and just mount ArrayField when not needed. I think the component folder needs to be exposed. UISchema is great but there are use cases where we may need more control.

Can you explain your use case? Several more components of ArrayField were exposed in the v5 beta as templates. Maybe your use case has been simplified by those changes?

So I have some properties that are of type array but I want to render/edit them in a text editor (monaco-editor) component. This requires giving full control of the array editing to the component that renders the Monaco editor. It seems to me that the ArrayField has some abstractions that are not needed in this case and can create problems. The array field assumes that each item will be rendered in a list but in this case, the text editor will just handle it differently. The only thing that the editor needs is to the get an array, and pass the array back. For this use case, I have to override ArrayField when the array property requires a text editor and use ArrayField with it is needed.

Is there a way to override ArrayField and still be able to access the original ArrayField without an import? Same question for templates?

kikonejacob avatar Aug 30 '22 20:08 kikonejacob

You could try calling getDefaultRegistry() and access fields.ArrayField. The same would also work for the templates.

const defaultRegistry = getDefaultRegistry();
const { ArrayField } = defaultRegistry.fields;

heath-freenome avatar Aug 31 '22 02:08 heath-freenome

@kikonejacob In 5.0.0-beta.7 we added a new field called ArraySchemaField (defaulting to SchemaField) which lets you override the way an array item children is rendered. This is the children prop passed to the ArrayFieldItemTemplate. Now in your specific use case you can override just that ArraySchemaField to modify the name before passing it down to the SchemaField in a manner similar to how you would have accessed the ArrayField itself. Hopefully that simplifies your use case alot

heath-freenome avatar Sep 15 '22 06:09 heath-freenome

@kikonejacob In 5.0.0-beta.7 we added a new field called ArraySchemaField (defaulting to SchemaField) which lets you override the way an array item children is rendered. This is the children prop passed to the ArrayFieldItemTemplate. Now in your specific use case you can override just that ArraySchemaField to modify the name before passing it down to the SchemaField in a manner similar to how you would have accessed the ArrayField itself. Hopefully that simplifies your use case alot

Thanks. I. will try it out

kikonejacob avatar Sep 25 '22 03:09 kikonejacob