def propmerge(into, data_from):
    """ Merge JSON schema requirements into a dictionary """
    newprops = copy.deepcopy(into)

    for prop, propval in six.iteritems(data_from):
        if prop not in newprops:
            newprops[prop] = propval
            continue

        new_sp = newprops[prop]
        for subprop, spval in six.iteritems(propval):
            if subprop not in new_sp:
                new_sp[subprop] = spval

            elif subprop == 'enum':
                new_sp[subprop] = set(spval) & set(new_sp[subprop])

            elif subprop == 'type':
                if spval != new_sp[subprop]:
                    raise TypeError("Type cannot conflict in allOf'")

            elif subprop in ('minLength', 'minimum'):
                new_sp[subprop] = (new_sp[subprop] if
                                   new_sp[subprop] > spval else spval)
            elif subprop in ('maxLength', 'maximum'):
                new_sp[subprop] = (new_sp[subprop] if
                                   new_sp[subprop] < spval else spval)
            elif subprop == 'multipleOf':
                if new_sp[subprop] % spval == 0:
                    new_sp[subprop] = spval
                else:
                    raise AttributeError(
                        "Cannot set conflicting multipleOf values")
            else:
                new_sp[subprop] = spval

        newprops[prop] = new_sp

    return newprops
Merge JSON schema requirements into a dictionary