private void check(Node left, Node right) {
            // Only perform nested diffs if the right node was found.
            if (right.isNullNode() && !segements.isEmpty()) {
                return;
            }

            Map<String, Node> leftValues = new TreeMap<>();
            Map<String, Node> rightValues = new TreeMap<>();
            extract(leftValues, trait, 0, left, "");
            extract(rightValues, trait, 0, right, "");

            // Compare values that exist only in left or in both.
            for (Map.Entry<String, Node> entry : leftValues.entrySet()) {
                Node rightValue = rightValues.getOrDefault(entry.getKey(), Node.nullNode());
                compareResult(entry.getKey(), entry.getValue(), rightValue);
            }

            // Find newly added values.
            for (Map.Entry<String, Node> entry : rightValues.entrySet()) {
                if (!leftValues.containsKey(entry.getKey())) {
                    compareResult(entry.getKey(), Node.nullNode(), entry.getValue());
                }
            }
        }
Finds breaking changes related to when a trait is added, removed, or
updated based on the breakingChanges property of traits.
smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/TraitBreakingChange.java