json-editor / json-editor

JSON Schema Based Editor
MIT License
4.43k stars 654 forks source link

How to write a Schema to describe the json Schema self of json-editor? #52

Closed metled closed 5 years ago

metled commented 6 years ago

I'd like to have an editor letting users design the json schema, which could be used to produce the json-editor as the project. i.e. the super json schema -> editor for json schema -> editor for json

metled commented 6 years ago
{
  "title": "json schema",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "title for json",
    },
    "type": {
      "type": "string",
      "enum": ["object", "array", ...]
      ...
    },
    "properties": {
        "type": "array"
        ...
    }
  }
}

is it possible?

marc7000 commented 6 years ago

Did you see the basic json-editor demo? https://json-editor.github.io/json-editor/

There is a schema text-area below the editor where you can edit the schema and update the editor.

metled commented 6 years ago

Thanks, I understood that a user can edit the schema text to update the editor. My situation is that my users are not professional, that whether they can use an editor to generate the schema, i.e. json-editor can edit the schema based on the schema's schema.

schmunk42 commented 6 years ago

@metled That should be possible and I'd really like to see an example for this. Actually the way you showed in the example looks good to me.

I googled for some existing "json-schema for json-schema", but haven't found a matching piece.

Work on this would be very appreciated.

schmunk42 commented 6 years ago

Another starting point is feeding ie. http://json-schema.org/draft-04/schema# into the editor, which at least shows a working form... Example

wclssdn commented 6 years ago

Are you looking for this? http://json.bootsphp.com/jsonSchemaCreator/

schmunk42 commented 6 years ago

@wclssdn Wow, this looks neat!

niebert commented 6 years ago

You can also start from a JSON of your choice and create a JSON Schema for the JSON Editor by https://niebert.github.io/JSON2Schema . The JSON2Schema Tool used the JSON Editor developed by Jeremy Dorn to create the JSON Schema and finally you see the look of the JSON Editor in https://niebert.github.io/JSON2Schema . Because a JSON Schema is JSON too you might find the workflow from JSON to a JSON Schema useful.

pmk65 commented 5 years ago

Added info to Wiki.

IanMayo commented 5 years ago

Hi all, I've created a new issue relating to this one #299

The schema the original poster was referring to was the JSON Meta-Schema. It exists, and can be used in JSON-Editor to create/edit a schema. But, the editor has sub-optimal formatting, since the JSON Meta-Schema doesn't contain the fancy JSON-Editor specific formatting hints.