object2form icon indicating copy to clipboard operation
object2form copied to clipboard

Supporting JSONSchema

Open beeing opened this issue 8 years ago • 5 comments

Hi, does the library accepts something like uiSchema to support for custom order of fields?

beeing avatar Oct 23 '17 00:10 beeing

Hi @beeing , could you please explain what uiSchema is? I admit i never heard of it...

IdanCo avatar Oct 23 '17 13:10 IdanCo

Oh sorry, you can refer to this - https://github.com/mozilla-services/react-jsonschema-form

beeing avatar Oct 23 '17 13:10 beeing

Oh! this is very cool!

It reminds me of the Angular Formly strategy.

The original motivation behind this project was to create a form from the already existing data object representing the form's data (i.e. { name: 'John', age: 32}). Following the example shown in the react-jsonschema-form, I refer to the part titled 'formData' at the bottom right:

image

Correct me if i'm wrong, but using uiSchema requires manually building the schema. Then again, maybe it's worth it if it enables much more robust functionality.

So I'm open for suggestions, and even more open to PRs.

IdanCo avatar Oct 23 '17 13:10 IdanCo

I like the idea of building form from JSON data, however in real-life, we usually need to tweak the form to provide a better feel of the displayed data.

With that said, the uiSchema can be totally optional.

Also... the displayed form can be read-only or editable.

beeing avatar Oct 23 '17 14:10 beeing

Reading further in react-jsonschema-form, i came across this explanation -

JSONSchema is limited for describing how a given data type should be rendered as a form input component, that's why this lib introduces the concept of UI schema.

So it look like neither JSONSchema nor uiSchema are enough on their own, and uiSchema even had to be invented to make it work. It feels like learning a new schema just to use a form rendering service is an overkill, not to mention that both formly and react-jsonschema-form does exactly that. So I'm not so sure it's worth the trouble, but i think it's worth considering, so I'm leaving this issue open in case you or anyone else has other thoughts on the matter.

IdanCo avatar Oct 23 '17 14:10 IdanCo