private Optional<ValidationEvent> checkForMismatches(ResourceShape resource, ResourceShape parent) {
        // Look for identifiers on the child that have the same key but target different shapes.
        String mismatchedTargets = parent.getIdentifiers()
                .entrySet()
                .stream()
                .filter(entry -> resource.getIdentifiers().get(entry.getKey()) != null)
                .filter(entry -> !resource.getIdentifiers().get(entry.getKey()).equals(entry.getValue()))
                .map(entry -> String.format(
                        "expected the `%s` member to target `%s`, but found a target of `%s`",
                        entry.getKey(),
                        entry.getValue(),
                        resource.getIdentifiers().get(entry.getKey())))
                .sorted()
                .collect(Collectors.joining("; "));

        if (mismatchedTargets.isEmpty()) {
            return Optional.empty();
        }

        return Optional.of(error(resource,
                String.format(
                        "The `identifiers` property of this resource is incompatible with its binding to `%s`: %s",
                        parent.getId(),
                        mismatchedTargets)));
    }
Validates that the resource identifiers of children of a resource contain
all of the identifiers as their parents.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ResourceIdentifierValidator.java