private void validateDeprecatedTargets(
            Shape shape,
            Shape target,
            RelationshipType relType,
            List<ValidationEvent> events
    ) {
        if (!target.hasTrait(DeprecatedTrait.ID)) {
            return;
        }

        String relLabel = RELATIONSHIP_TYPE_DEPRECATION_MAPPINGS.get(relType);
        if (relLabel == null) {
            return;
        }

        StringBuilder builder = new StringBuilder(relLabel).append(", ").append(target.getId());
        DeprecatedTrait deprecatedTrait = target.expectTrait(DeprecatedTrait.class);
        deprecatedTrait.getMessage().ifPresent(message -> builder.append(". ").append(message));
        deprecatedTrait.getSince().ifPresent(since -> builder.append(" (since ").append(since).append(')'));
        events.add(ValidationEvent.builder()
                .id("DeprecatedShape." + target.getId())
                .severity(Severity.WARNING)
                .shape(shape)
                .message(builder.toString())
                .build());
    }
Validates that neighbors target resolvable shapes of the correct type.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/TargetValidator.java