VisualJsonEditor icon indicating copy to clipboard operation
VisualJsonEditor copied to clipboard

Schema Editing

Open rkatzmann opened this issue 9 years ago • 8 comments

When opening any json file the editor immediately requires me to open a schema. However I don't have a schema. So I cannot edit it at all with that editor.

My wish is an enhancement in this direction. I see two possibilities:

  1. Add full-blown schema editing (preferred)

  2. Use optionally a generator to create a schema from the loaded json file.

    -> There are several schema generators available like npm -> However you might need need to add a setting for the npm binary path

rkatzmann avatar Jul 22 '16 06:07 rkatzmann

Thank you for the good idea. I currently dont have the spare time for this project... However if you'd like to help, please create a PR.

RicoSuter avatar Jul 28 '16 18:07 RicoSuter

This fix is now simple to implement: Just use JsonSchema4.FromData when no schema is availablr

RicoSuter avatar Jul 02 '17 21:07 RicoSuter

Is there an example somewhere on how to use "JsonSchema4.FromData" because I have json files I'd like to edit but when I got to load them clicking validate states " Its valid" but the UI is an empty white page.

demo7up avatar Dec 23 '19 16:12 demo7up

See https://github.com/RicoSuter/NJsonSchema/wiki/SampleJsonSchemaGenerator

RicoSuter avatar Dec 23 '19 17:12 RicoSuter

Is there a way to have the application auto generate a schema if none is detected? Or which file/portion of the source to look at for this.

demo7up avatar Dec 23 '19 17:12 demo7up

I dont think this feature is available. But it should be quite easy to add.

RicoSuter avatar Dec 23 '19 17:12 RicoSuter

Can I buy you a couple beers for some direction :D

demo7up avatar Dec 23 '19 18:12 demo7up

We need to move this if

https://github.com/RicoSuter/VisualJsonEditor/blob/master/src/VisualJsonEditor/ViewModels/MainWindowModel.cs#L184

To

https://github.com/RicoSuter/VisualJsonEditor/blob/master/src/VisualJsonEditor/Models/JsonDocumentModel.cs#L119

And generate it from data if file does not exist

RicoSuter avatar Dec 23 '19 18:12 RicoSuter