Generate forms from JSON Schema
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[x ] feature request
[ ] support request
Current behavior
If you want to dynamically create forms from JSON saved in your database you currently need to define each field specifically for this form.
Expected behavior
For just a form with validation and some basic vertical layout you add a JSON schema containing all the fields in the forms and how they should be validated. Where validation could either be done through Angular Reactive forms or using a JSON schema validator like ajv
.
Minimal reproduction of the problem with instructions
There are a few other Angular form libraries similar but less popular and stable that instead use JSON schema’s
- https://github.com/makinacorpus/ngx-schema-form
- https://github.com/dschnelldavis/angular2-json-schema-form
Also some older but more popular versions in Angular.js, JQuery and React versions.
What is the motivation / use case for changing the behavior?
JSON schema’s can be used for validation on the server, be it through ajv
when accepting the request from the client or using JSON schemas for validation in MongoDB.
More than anything it’s also a standardized way to describe objects and validation so there might be some already familiar with how to do it using this format.
Our particular use-case has been crafting dozens of smaller forms with JSON schema’s. Using angular2-json-schema-form for a while now to create forms from them. But with that library being a bit unstable and showing very little progress we’re considering our options between trying to support further development of that library or moving over to another library, like this library.
Is this a feasible direction for this library to go towards? And are you interested in taking it down that path? As an alternative to the current structure. And in either case, would PRs to implement this functionality be accepted (given acceptable quality)?
An alternate solution, if the answer is no, would be to try to make some kind of logic that converts JSON schema to the format you use in this library. As it stands we’d probably take some time to investigate that option further.
Either way, very impressed by this library 🙂.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:17 (9 by maintainers)
a little progress in
json-schema
is landed in v5.3 release 🎉!initial support landed in
5.0.0-alpha.2
, I’ve decided to follow https://mozilla-services.github.io/react-jsonschema-form/ which contains lot of examples that we can use in our demo examples the array type is partially supported for now and since I’m not usingjsnon-schema
I would like to leave that part to anyone interested!the first step is to add a unit test for FormlyJsonschema service.
@kenisteward yes I’m waiting your PRs and anyone willing to participate 😃