private Optional<ValidationEvent> validateExpandedPattern(
            OperationShape operation,
            EndpointTrait endpoint
    ) {
        // Replace all label portions with stubs so the hostPrefix
        // can be validated.
        String stubHostPrefix = endpoint.getHostPrefix()
                .getSegments()
                .stream()
                .map(segment -> segment.isLabel() ? "foo" : segment.getContent())
                .collect(Collectors.joining());
        if (!EXPANDED_PATTERN.matcher(stubHostPrefix).matches()) {
            return Optional.of(error(operation,
                    endpoint,
                    format("The `endpoint` trait hostPrefix, %s, could "
                            + "not expand in to a valid RFC 3986 host: %s", endpoint.getHostPrefix(), stubHostPrefix)));
        }
        return Optional.empty();
    }
Match the expanded template to be a valid RFC 3896 host.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HostLabelTraitValidator.java