monaco-react icon indicating copy to clipboard operation
monaco-react copied to clipboard

JSON validation against provided schema?

Open daudnadeem opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. I am trying to use your (super-cool) editor to edit some JSON on a website. When I submit the JSON, it is validated against a schema in the backend and then it's either allowed (200) or denied (422). When it's denied, I would like to parse the error and show it in the editor.

e.g.

{
  name: "Adam"
  age: "24"
}

And if age: int

I would like "24" to be highlighted, and the error from the backend parse "needs to be an int" straight from the backend.

Additional context I feel there may already be a way to do this, I am a full stack dev trying to break into the FE world. Have good experience with the backend, if there is a way to already do this please guide me. I am trying to use onValidate and I see it gets markers from the errors. So all I really need to do is insert custom markers?

daudnadeem avatar Nov 02 '23 15:11 daudnadeem

This repo is a React wrapper for the actual Monaco editor from Microsoft: https://github.com/microsoft/monaco-editor/, so you will probably find more info there. In particular, you can check this example.

Viicos avatar Mar 04 '24 08:03 Viicos

This issue has been marked as stale due to inactivity. It will be closed in 7 days unless further activity occurs.

github-actions[bot] avatar Mar 16 '25 00:03 github-actions[bot]

Closing due to inactivity. Feel free to reopen if needed.

github-actions[bot] avatar Mar 23 '25 00:03 github-actions[bot]