private List<ValidationEvent> validateService(TopDownIndex topDownIndex, ServiceShape service) {
        List<ValidationEvent> events = new ArrayList<>();

        for (OperationShape operation : topDownIndex.getContainedOperations(service)) {
            ShapeId id = operation.getId();
            Set<Shape> containers = new HashSet<>();
            if (service.getOperations().contains(id)) {
                containers.add(service);
            }

            for (ResourceShape resource : topDownIndex.getContainedResources(service.getId())) {
                if (resource.getAllOperations().contains(id)) {
                    containers.add(resource);
                }
            }

            if (containers.size() > 1) {
                events.add(error(operation,
                        String.format(
                                "An operation can appear only once in an entire service closure. This operation is "
                                        + "illegally bound into the `%s` service closure from multiple shapes: %s",
                                service.getId(),
                                containers.stream().map(Object::toString).sorted().collect(Collectors.joining(", ")))));
            }
        }

        return events;
    }
Validates that an operation is only bound to once in an entire
service closure.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleOperationBindingValidator.java