@Override
    public Model onRemove(ModelTransformer transformer, Collection<Shape> shapes, Model model) {
        Map<Shape, Set<Shape>> mixinShapesToRemove = new HashMap<>();

        for (Shape removedShape : shapes) {
            if (removedShape.hasTrait(MixinTrait.ID) && !removedShape.isMemberShape()) {
                // Remove the mixin from any shape that uses it.
                Stream.concat(model.shapes(StructureShape.class), model.shapes(UnionShape.class)).forEach(shape -> {
                    if (shape.getMixins().contains(removedShape.getId())) {
                        mixinShapesToRemove.computeIfAbsent(shape, s -> new HashSet<>()).add(removedShape);
                    }
                });
            }
        }

        if (mixinShapesToRemove.isEmpty()) {
            return model;
        }

        List<Shape> toReplace = new ArrayList<>(mixinShapesToRemove.size());
        for (Map.Entry<Shape, Set<Shape>> entry : mixinShapesToRemove.entrySet()) {
            AbstractShapeBuilder<?, ?> builder = Shape.shapeToBuilder(entry.getKey());
            for (Shape mixin : entry.getValue()) {
                builder.removeMixin(mixin);
            }
            toReplace.add(builder.build());
        }

        // The replace transform handles ensuring that any updated mixins as a result
        // of removing mixins are reflected in inherited shapes.
        return transformer.replaceShapes(model, toReplace);
    }
Removes mixins from shapes when a mixin is removed from the model.
smithy-model/src/main/java/software/amazon/smithy/model/transform/plugins/RemoveMixins.java