Has anyone found a good way to allow the user to edit a JSON document that enforce schema validation?
Currently I use the JSON TypedInput, but the only way I found to implement the schema validation to return false on validation error. It does not give the best user experience that they have to close the editor to see the validation error.
Is that true, I seem to remember seeing a red outline to the editor if the JSON isn't valid?
But in any case, if you could add a schema validation extension to the Monaco editor, it should be possible to tie into its validation. Dynamic display should then be possible anyway as long as there is some event to tie into. I'm not familiar with the internals of Monaco but as it is specifically built with live Linting in mind, I would expect there to be something that can be used.
Yes, but as long as the Monaco validations creates an event, then the Node-RED Editor can respond to it. The REACT example I shared is a very similar parallel. There is nothing special about the Editor, it is a web page when all is said and done.
Looks like JSON Schema validation is available in Monaco itself?
Yes, it is. A call to monaco.languages.json.jsonDefaults would do it. However, the user would need to first duplicate the json model (i.e. as json_my_node model) and apply it to THAT model as all the the models are shared (i.e. we would now want all JSON inputs to be validated with the schema this node adds)