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

Method additionalProperties

src/validator.js:599–623  ·  view source on GitHub ↗
(schema, value, path, validatedProperties)

Source from the content-addressed store, hash-verified

597 return errors
598 },
599 additionalProperties (schema, value, path, validatedProperties) {
600 const errors = []
601 const keys = Object.keys(value)
602 for (let i = 0; i < keys.length; i++) {
603 const k = keys[i]
604 if (validatedProperties[k]) continue
605 /* No extra properties allowed */
606 if (!schema.additionalProperties) {
607 errors.push({
608 path,
609 property: 'additionalProperties',
610 message: this.translate('error_additional_properties', [k], schema)
611 })
612 break
613 /* Allowed */
614 } else if (schema.additionalProperties === true) {
615 break
616 /* Must match schema */
617 /* TODO: incompatibility between version 3 and 4 of the spec */
618 } else {
619 errors.push(...this._validateSchema(schema.additionalProperties, value[k], `${path}.${k}`))
620 }
621 }
622 return errors
623 },
624 dependencies (schema, value, path) {
625 const errors = []
626 Object.entries(schema.dependencies).forEach(([i, dep]) => {

Callers

nothing calls this directly

Calls 1

_validateSchemaMethod · 0.95

Tested by

no test coverage detected