RicoSuter / VisualJsonEditor

A JSON schema based file editor for Windows.
http://visualjsoneditor.org
MIT License
349 stars 87 forks source link

Schema Editing #6

Open rkatzmann opened 8 years ago

rkatzmann commented 8 years ago

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

RicoSuter commented 8 years ago

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 commented 7 years ago

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

demo7up commented 4 years ago

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.

RicoSuter commented 4 years ago

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

demo7up commented 4 years ago

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.

RicoSuter commented 4 years ago

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

demo7up commented 4 years ago

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

RicoSuter commented 4 years ago

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