private void validateTrait(Model model, Shape shape, List<ValidationEvent> events) {
        TraitDefinition trait = shape.expectTrait(TraitDefinition.class);

        for (int i = 0; i < trait.getBreakingChanges().size(); i++) {
            TraitDefinition.BreakingChangeRule diffRule = trait.getBreakingChanges().get(i);
            // No need to validate empty paths or paths that are "", meaning the entire trait.
            if (diffRule.getPath().isPresent() && !diffRule.getPath().get().toString().equals("")) {
                Shape current = shape;
                NodePointer pointer = diffRule.getPath().get();
                int segment = 0;
                for (String part : pointer.getParts()) {
                    Shape previous = current;
                    current = current.getMember(part)
                            .flatMap(member -> model.getShape(member.getTarget()))
                            .orElse(null);
                    if (current == null) {
                        events.add(emit(shape, i, segment, previous));
                        break;
                    }
                    segment++;
                }
            }
        }
    }
Validates that the JSON pointer paths of the breakingChanges property
of a trait refers to valid parts of the model.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/TraitBreakingChangesValidator.java