How to use the schema-based-json-editor.compare function in schema-based-json-editor

To help you get started, we’ve selected a few schema-based-json-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plantain-00 / schema-based-json-editor / packages / angular / src / object-editor.component.ts View on Github external
if (this.schema.properties.hasOwnProperty(property)) {
          const schema = this.schema.properties[property]
          const propertyName = schema.propertyName || property
          if (this.isRequired(property) !== false) {
            const required = this.schema.required && this.schema.required.some(r => r === property)
            this.value[propertyName] = common.getDefaultValue(required, schema, this.value[propertyName]) as { [name: string]: common.ValueType }
          }

          this.properties.push({
            property,
            propertyName,
            schema
          })
        }
      }
      this.properties.sort(common.compare)
    }
    this.updateValue.emit({ value: this.value, isValid: this.invalidProperties.length === 0 })
  }
  isRequired(property: string) {
github plantain-00 / schema-based-json-editor / packages / vue / src / object-editor.ts View on Github external
for (const property in this.schema.properties) {
        if (this.schema.properties.hasOwnProperty(property)) {
          const schema = this.schema.properties[property]
          const propertyName = schema.propertyName || property
          if (this.isRequired(property) !== false) {
            const required = this.schema.required && this.schema.required.some(r => r === property)
            this.value[propertyName] = common.getDefaultValue(required, schema, this.value[propertyName]) as { [name: string]: common.ValueType }
          }
          this.properties.push({
            propertyName,
            property,
            schema
          })
        }
      }
      this.properties.sort(common.compare)
    }
    for (const property in this.schema.properties) {
      const schema = this.schema.properties[property]
      if (schema && schema.requiredWhen && !this.watchedProperties.includes(schema.requiredWhen[0])) {
        this.watchedProperties.push(schema.requiredWhen[0])
      }
    }
    this.$emit('update-value', { value: this.value, isValid: true })
  }
github plantain-00 / schema-based-json-editor / packages / react / src / object-editor.tsx View on Github external
for (const property in this.props.schema.properties) {
        if (this.props.schema.properties.hasOwnProperty(property)) {
          const schema = this.props.schema.properties[property]
          const propertyName = schema.propertyName || property
          if (this.isRequired(property) !== false) {
            const required = this.props.schema.required && this.props.schema.required.some(r => r === property)
            this.value[propertyName] = common.getDefaultValue(required, schema, this.value[propertyName]) as { [name: string]: common.ValueType }
          }
          this.properties.push({
            property,
            propertyName,
            schema
          })
        }
      }
      this.properties = this.properties.sort(common.compare)
    }
  }
  componentDidMount() {