@Override
    protected void check(Shape shape, LengthTrait trait, StringNode node, Context context, Emitter emitter) {
        String value = node.getValue();
        int size = value.getBytes(StandardCharsets.UTF_8).length;

        trait.getMin().ifPresent(min -> {
            if (size < min) {
                emitter.accept(node,
                        getSeverity(context),
                        "Value provided for `" + shape.getId()
                                + "` must have at least " + min + " bytes, but the provided value only has " + size
                                + " bytes");
            }
        });

        trait.getMax().ifPresent(max -> {
            if (value.getBytes(StandardCharsets.UTF_8).length > max) {
                emitter.accept(node,
                        getSeverity(context),
                        "Value provided for `" + shape.getId()
                                + "` must have no more than " + max + " bytes, but the provided value has " + size
                                + " bytes");
            }
        });
    }
Validates length trait on blob shapes and members that target blob shapes.
smithy-model/src/main/java/software/amazon/smithy/model/validation/node/BlobLengthPlugin.java