(schema, value, path)
| 696 | } |
| 697 | |
| 698 | _validateSchema (schema, value, path) { |
| 699 | const errors = [] |
| 700 | path = path || this.jsoneditor.root.formname |
| 701 | |
| 702 | /* Work on a copy of the schema */ |
| 703 | schema = extend({}, this.jsoneditor.expandRefs(schema)) |
| 704 | |
| 705 | /* |
| 706 | * Type Agnostic Validation |
| 707 | */ |
| 708 | /* Version 3 `required` and `required_by_default` */ |
| 709 | if (typeof value === 'undefined') { |
| 710 | return this._validateV3Required(schema, value, path) |
| 711 | } |
| 712 | |
| 713 | Object.keys(schema).forEach(key => { |
| 714 | if (this._validateSubSchema[key]) { |
| 715 | errors.push(...this._validateSubSchema[key].call(this, schema, value, path)) |
| 716 | } |
| 717 | }) |
| 718 | |
| 719 | /* |
| 720 | * Type Specific Validation |
| 721 | */ |
| 722 | errors.push(...this._validateByValueType(schema, value, path)) |
| 723 | |
| 724 | if (schema.links) { |
| 725 | schema.links.forEach((s, m) => { |
| 726 | if (s.rel && s.rel.toLowerCase() === 'describedby') { |
| 727 | schema = this._expandSchemaLink(schema, m) |
| 728 | errors.push(...this._validateSchema(schema, value, path, this.translate)) |
| 729 | } |
| 730 | }) |
| 731 | } |
| 732 | |
| 733 | /* date, time and datetime-local validation */ |
| 734 | if (['date', 'time', 'datetime-local'].includes(schema.format)) { |
| 735 | errors.push(...this._validateDateTimeSubSchema(schema, value, path)) |
| 736 | } |
| 737 | |
| 738 | /* uuid validation */ |
| 739 | if (['uuid'].includes(schema.format)) { |
| 740 | errors.push(...this._validateUUIDSchema(schema, value, path)) |
| 741 | } |
| 742 | |
| 743 | /* custom validator */ |
| 744 | errors.push(...this._validateCustomValidator(schema, value, path)) |
| 745 | |
| 746 | /* Remove duplicate errors and add "errorcount" property */ |
| 747 | return this._removeDuplicateErrors(errors) |
| 748 | } |
| 749 | |
| 750 | _expandSchemaLink (schema, m) { |
| 751 | const href = schema.links[m].href |
no test coverage detected