jsonnext / codemirror-json-schema

A JSONSchema enabled mode for codemirror 6, for json4 and json5, inspired by monaco-json
https://codemirror-json-schema.netlify.app
MIT License
56 stars 9 forks source link

Error verification #97

Closed mlj18293180341 closed 1 month ago

mlj18293180341 commented 1 month ago

Is there a validation method for organizing data submission, similar to form validation

imolorhe commented 1 month ago

Could you clarify your question? Maybe illustrate with an example?

mlj18293180341 commented 1 month ago

Could you clarify your question? Maybe illustrate with an example?

Sorry, there was an issue with my previous problem description. What I meant was to call the method of the component to prevent event submission. I can verify the error now, but I cannot prevent the submission of data. I saw the doValidate method in the source code, but it was not exported

imolorhe commented 1 month ago

I still think this needs some clarification. codemirror-json-schema provides codemirror extensions to be used as part of codemirror based editors. It doesn't handle anything related to data or event submission. It sounds like you need to raise this issue with codemirror itself? Perhaps there's more relevant help there as this doesn't sound related to codemirror-json-schema

acao commented 1 month ago

perhaps you are looking for something to validate data with your json schema for other purposes? there are many libraries, including ajv and json schema library which we use to validate runtime data. we just provide a codemirror mode that implements such tools.

for example, there is a react hook json forms library, and many similar libraries for other frameworks!