I'm doing something similar with serializing django forms and sending them to a react app that turns the json into a form. It's a really convenient way of doing things.
Show HN: Generate React forms from JSON form schemas
21–28 of 28 posts
Re: Show HN: Generate React forms from JSON form schemas
#22I would strongly recommend that anyone looking into something like this first look at JSON Schema[1], which is a pretty widely adopted standard. We're doing server and client validation with one set of rules, and there are lots of libraries that will clean up your data given a schema. [1] http://json-schema.org/examples.html
You can think of it like RubyGems.org or Maven Central but for storing vendored, versioned data schemas instead of code.
Re: Show HN: Generate React forms from JSON form schemas
#23I'm doing something similar with serializing django forms and sending them to a react app that turns the json into a form. It's a really convenient way of doing things.
Really sorry, down voted you by mistake with a loose finger. App I use has moved the vote buttons right where I scroll.
Re: Show HN: Generate React forms from JSON form schemas
#24I'm doing something similar with serializing django forms and sending them to a react app that turns the json into a form. It's a really convenient way of doing things.
Can you provide more details how do you serialize django forms?
Edit: basically just creating a dict out of the various attributes and then passing to json.dumps()
Re: Show HN: Generate React forms from JSON form schemas
#25Maybe I am missing something but how are they dealing with dates?
I would assume by using ISO 8601 dates which is the closest thing there is to a standard date format in JSON.
Re: Show HN: Generate React forms from JSON form schemas
#26Re: Show HN: Generate React forms from JSON form schemas
#27Re: Show HN: Generate React forms from JSON form schemas
#28See also tcomb-form [1] with it's tcomb-json-schema plugin [2]. We're currently using react-forms with a custom json-schema to react-forms schema conversion. [1] https://github.com/gcanti/tcomb-form [2] https://github.com/gcanti/tcomb-json-schema
In some sense it enables your program to resemble a type system and be able to easily serialise it at runtime. Kind of similar to how games are written, I believe. And with tcomb-form you can easily have a ui layer as well.