josdejong / josdejong/jsoneditor

Document error types for onValidationError

Open
#1,115 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
12.3k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

I am trying to implement `onValidationError` so that it displays errors in my own element, as well as in the editor. However, the documentation doesn't describe what properties to expect on error objects beyond `error.type`. So far I've found

- validation errors:
- "type": "validation"
- "error": [Ajv error object](https://github.com/ajv-validator/ajv#validation-errors)
- "node": Ajv node reference?
- custom validation errors
- "type": "customValidation'
- whatever gets returned by `onValidate`. The examples seem to recommend a 'message' property.
- parse errors:
- "type": "error"
- "message": long html error message, often with `
`

I was not able to find the short form of parse errors which are visible in the tooltips when hovering over a red error icon.

Is this an accurate summary of the error objects? Could we add this info to the API documentation and/or `examples/22_on_validation_event.html`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.