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

Method dependencies

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

Source from the content-addressed store, hash-verified

622 return errors
623 },
624 dependencies (schema, value, path) {
625 const errors = []
626 Object.entries(schema.dependencies).forEach(([i, dep]) => {
627 /* Doesn't need to meet the dependency */
628 if (typeof value[i] === 'undefined') return
629
630 /* Property dependency */
631 if (Array.isArray(dep)) {
632 dep.forEach(d => {
633 if (typeof value[d] === 'undefined') {
634 errors.push({
635 path,
636 property: 'dependencies',
637 message: this.translate('error_dependency', [d], schema)
638 })
639 }
640 })
641 /* Schema dependency */
642 } else {
643 errors.push(...this._validateSchema(dep, value, path))
644 }
645 })
646 return errors
647 }
648 }
649 }
650

Callers

nothing calls this directly

Calls 1

_validateSchemaMethod · 0.95

Tested by

no test coverage detected