private List<ValidationEvent> validateTrait(ChangedShape<Shape> change, Pair<T, T> changedTrait) {
        List<ValidationEvent> events = new ArrayList<>();
        T oldTrait = changedTrait.getLeft();
        T newTrait = changedTrait.getRight();
        BigDecimal oldMin = getMin(oldTrait).orElse(BigDecimal.ZERO);
        BigDecimal newMin = getMin(newTrait).orElse(BigDecimal.ZERO);
        BigDecimal oldMax = getMax(oldTrait).orElse(null);
        BigDecimal newMax = getMax(newTrait).orElse(null);

        if (newMin.compareTo(oldMin) > 0) {
            events.add(error(change.getNewShape(),
                    String.format(
                            "%s trait value `min` was made more restrictive by raising from %s to %s",
                            newTrait.toShapeId(),
                            oldMin,
                            newMin)));
        }

        if (newMax != null && (oldMax == null || oldMax.compareTo(newMax) > 0)) {
            events.add(error(change.getNewShape(),
                    String.format(
                            "%s trait value `max` was made more restrictive by lowering from %s to %s",
                            newTrait.toShapeId(),
                            oldMax,
                            newMax)));
        }

        return events;
    }
Implements the shared logic for length and range trait validation.

@param <T> LengthTrait or RangeTrait types to validate.
smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AbstractLengthAndRangeValidator.java