mariohmol / ang-jsoneditor

Angular Jsoneditor that works with angular 4 to angular 15
https://stackblitz.com/edit/angular-json-editor
MIT License
156 stars 89 forks source link

Unsupported options 'schemaRefs' and 'onValidationError' #66

Closed davebaol closed 4 years ago

davebaol commented 4 years ago

Is your feature request related to a problem? Please describe. Peer dependency from jsoneditor is outdated and both options schemaRefs and onValidationError are not supported by JsonEditorOptions

Describe the solution you'd like

Describe alternatives you've considered I could extend JsonEditorOptions with missing options and pass that instance to the component. Looks like it works, but I'm not sure about possible drawbacks. Also it sounds like a hack.

davebaol commented 4 years ago

Also, after updating peer dependencies to jsoneditor ^8.6.8

  public setSchema(schema: any) {
    this.editor.setSchema(schema);
  }

should become

  public setSchema(schema: any, schemaRefs: any) {
    this.editor.setSchema(schema, schemaRefs);
  }
RondoK commented 4 years ago

@davebaol You can get access to onValidationError via "brackets property access"

this.editorOptions["onValidationError"] = (errors: object[ ]) : void => { YOUR_CODE_HERE }

mariohmol commented 4 years ago

added this in the latest.. thanks