MCPcopy Create free account
hub / github.com/json-editor/json-editor / required

Method required

src/validator.js:471–488  ·  view source on GitHub ↗
(schema, value, path)

Source from the content-addressed store, hash-verified

469 return []
470 },
471 required (schema, value, path) {
472 const errors = []
473 if (Array.isArray(schema.required)) {
474 schema.required.forEach(e => {
475 if (typeof value[e] !== 'undefined') return
476 const editor = this.jsoneditor.getEditor(`${path}.${e}`)
477 if (editor && editor.dependenciesFulfilled === false) return
478 /* Ignore required error if editor is of type "button" or "info" */
479 if (editor && ['button', 'info'].includes(editor.schema.format || editor.schema.type)) return
480 errors.push({
481 path,
482 property: 'required',
483 message: this.translate('error_required', [schema && schema.properties && schema.properties[e] && schema.properties[e].title ? schema.properties[e].title : e], schema)
484 })
485 })
486 }
487 return errors
488 },
489 properties (schema, value, path, validatedProperties) {
490 const errors = []
491 Object.entries(schema.properties).forEach(([key, prop]) => {

Callers

nothing calls this directly

Calls 1

getEditorMethod · 0.80

Tested by

no test coverage detected