3 ms·
I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model ch
by softwarelimits 7y ago
I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes.
As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do not do that.
- bluebill1049 7y agoeverything is about pros and cons. there is no silver bullet for building form if you enjoy building a form with JSON schema good for you too. Thanks for checking it out tho :)
- throwaway_bad 7y agoCan you point to a real world example of what you mean? I think I have heard of something similar but it didn’t seem to have caught on in any major web frameworks that I know of (strongly typed json API server which generates runtime validators on frontend and backend). Even then most people want control over the presentation of the form and wouldn’t want to create fields from the schema (e.g. a number type is sometimes a slider and sometimes a drop down)
- tiborsaas 7y agoA friend of mine build a solution like this: https://laraform.io/ https://laraform.io/ If I have a form anything more complex than a login page, then I usually use some kind of generator based on a schema.
- bluebill1049 7y agointeresting project! thanks for sharing
- mickael-kerjean 7y agoThere's a few people trying to build libraries (https://github.com/rjsf-team/react-jsonschema-form https://github.com/rjsf-team/react-jsonschema-form) but there ain't any magic bullet. For this project (https://github.com/mickael-kerjean/filestash https://github.com/mickael-kerjean/filestash), I built my very own as no other library would work for what I wanted
- softwarelimits 7y agoI was not writing about a specific product but about a way to implement form generation. Most web frameworks come with the basic building blocks.
- dgb23 7y agoI agree somewhat. A plain data format (like JSON) should be used to generate Forms, so your client/server side validation is always in sync (DRY). But this isn't mutually exclusive. You could use this component and generate the implementation (or just plainly transform your data into this with a function). Especially since it leans very heavily on the HTML standard, which has several advantages. Having a look at the code examples and documentation it would seem ergonomic to just feed JSON into a component that uses this.
- bluebill1049 7y agoI agree. the lib itself is primitive enough for you to build a JSON formate to generate forms. here is an good example: https://github.com/start-at-root/react-breeze-form https://github.com/start-at-root/react-breeze-form
- thiht 7y agoHow on Earth does this remotely look like "PHP 15 years ago" to you?
- bluebill1049 7y agolol
- ulucs 7y agoAt an earlier job, I got so annoyed with the constantly changing requirements I developed a form generator. With AngularJS. I wish I could've saved the code, it was so beautiful and horrible.
- bluebill1049 7y agoit's beautiful when it all works, it's horrible when requirements changes.
- nobleach 7y agoI'm in the process of ripping a system like this out of our main onboarding application. The idea sounded so great: "Just add another object to an array and the form field will magically appear with validation, persistence, etc". The reality is that business requirements turned it into a ton of special case "if" statements. I'm going to avoid that for the next go-round.
- bluebill1049 7y agoyea, I have been working forms for a while, there is hardly a page where a form just couple inputs and a submit button. There are conditional display, design and UX requirements. I can see this working for a one-page simple form.
- nobleach 7y agoIf all goes according to plan, we plan to use your library in an update to our onboarding process. You've even helped me in your GitHub issues, so you are very appreciated!
- bluebill1049 7y agooh sweet! that's great to hear. my pleasure to help.
- h0h0h0h0111 7y agoIn my experience, this is a pie in the sky dream - orchestrating dropdown loading and lazy loading becomes challegning. Dependencies between inputs become impossible (if this field is filled [or set to value x], show this section of the form, if this field is of value x, only allow values of a, b or c in field y). Not only this, but I think generally when a backend change happens you want to be aware of it (and fail early, probably in the test/integration phase!) - leaving it potentially as late as runtime could be devastating. For very basic forms generation from a model is fine, but I think it hits its limits pretty quickly. Imo generating a model from a schema is an okay halfway house. Regardless, this tool seems pretty nice, and could save me a little boiler plate!
- bluebill1049 7y agoAgree, also there is also UI and UX's input on how the form should behave and its looking feel, it's not always just couple inputs and a submit button :)
- Existenceblinks 7y agoThe latest JSON Schema draft introduces some nasty patches that fix the previous draft's limitation. It's even more confusing, it's not designed to generate form even if people have tried (some things can't easily map to form) and the latest spec said so.
- bluebill1049 7y agoagree. it all looks good on paper until the requirement and design changes, then you are in world of pain.
- Existenceblinks 7y agoApplication like configuration UI is probably fine, for example, system preference. It has sort of generic UX.
- bluebill1049 7y agoyes, the right tool for the right job.