Open danwf opened 8 years ago
UPDATE: Check out this issue: https://github.com/jdorn/json-editor/issues/507
I tried to create this exact same thing the other day by using the JSON Schema that defines JSON Schema called the Core/Validation Meta-Schema, found here: http://json-schema.org/documentation.html)
Unfortunately, json-editor does not work with the circular references in there.
Potentially with a little bit of tweaking, you could massage the JSON Meta Schema to make it work.
allow editing of the JSON schema itself via another form?
You can use two instances of json-editor, side-by-side: One for the schema, one for the data. Recreate the one for the data when the schema updates. I'm doing this in one project (closed-source, sorry) for the kind of admin-page you described and it works.
@oleics How are you handling showing all of the different fields like min/max, default values, etc. Since this package won't generate them, are you just adding them in by hand? That doesn't really work for my use case; I'm not expecting all of my end users to have a working knowledge of JSON or JSON schema.
Thanks @loganvolkers, I'll see if I can use @jdorn's examples/meta_schema.json
file to get something that works for my users.
@danwf
How are you handling showing all of the different fields like min/max, default values, etc.
json-editor does, the schema defines all required fields, the output is a json-schema.
Since this package won't generate them, are you just adding them in by hand?
There is one schema that defines how a schema looks like. It is kind of hardcoded, as I do not have the requirement yet to let users edit that schema too. So yes, by-hand; it's split up into multiple parts (files) to ease editing. A resolver puts all parts into one big fat json-schema (>1000LOC)
That doesn't really work for my use case; I'm not expecting all of my end users to have a working knowledge of JSON or JSON schema.
If I understand you correctly, then you need an even simpler schema than the one that I use, a more restricted one.
Or you want an editor, that guides users without a technical background through the creation-process of a json-schema. And that is a though task. A very though task. I would be very happy and thankfull for a open-source project providing that kind of convenience ;-)
@oleics have you seen this issue before when using a meta-schema? #661
This might be a big ask, but can we add a feature onto this to allow editing of the JSON schema itself via another form? I found this: https://github.com/thomas4019/json-schema-editor but I'd like to be able to have the same general UI look-and-feel, and I think it'd be good to have this in the same package.
The use case I'm thinking of is an admin-type page where the user creates configuration objects using the JSON editor, and can also create templates/schemas for those objects using the schema editor.