question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate forms from JSON Schema

See original GitHub issue

I’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

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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

12reactions
aitboudadcommented, Jul 24, 2019

a little progress in json-schema is landed in v5.3 release 🎉!

5reactions
aitboudadcommented, Aug 3, 2018

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 using jsnon-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 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Forms: More forms. Less code.
JSON Forms is a JSON Schema based approach for creating forms. It comes with off the shelf support for React, Angular and Vue....
Read more >
JSON Form - GitHub
Build forms from JSON Schema. Easily template-able. Compatible with Bootstrap 3 out of the box. - GitHub - jsonform/jsonform: Build forms from JSON...
Read more >
Create forms using the JSON Schema Form component
Create forms using the JSON Schema Form component · Demo · Generate the inputs · Validate submissions · Populate the form to update...
Read more >
How to Create a form from a json-schema? - Stack Overflow
JSONForms extends the view-model approach by eliminating the need to write HTML templates in order to create forms by leveraging the ...
Read more >
react-jsonschema-form documentation
react-jsonschema-form is meant to automatically generate a React form based on a JSON Schema. If you want to generate a form for any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found