func Validate(ctx context.Context, req interface{}) error  {
	muxed, ok := ctx.Value(MuxedGrpc{}).(bool)
	if !ok || !muxed {
		return nil
	}
	if v, ok := req.(validator); ok {
		if err := v.Validate(); err != nil {
			return status.Errorf(codes.InvalidArgument, err.Error())
		}
	}
	return nil
}
Validate by the contxt
package grpcmux
import (
	"context"
	"fmt"
	"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/grpclog"
	"google.golang.org/grpc/status"
	"google.golang.org/protobuf/encoding/protojson"
	"io"
	"net/http"
	"net/textproto"
	"strconv"
	"strings"
)
type ServeMux struct {
	*runtime.ServeMux
}
func DefaultHeaderMatcher(key string) (string, bool) {
	return strings.ToLower(key), true
}
func NewServeMux(opts ...runtime.ServeMuxOption) *ServeMux {
	if len(opts) == 0 {
		opts = append(opts,
			runtime.WithIncomingHeaderMatcher(DefaultHeaderMatcher),
			runtime.WithErrorHandler(DefaultHTTPErrorHandler),
			runtime.WithMarshalerOption("*", defaultMarshaler),
		)
	}
	return &ServeMux{runtime.NewServeMux(opts...)}
}
func (s *ServeMux) Handle(method string, path string, h runtime.HandlerFunc) {
	err := s.ServeMux.HandlePath(method, path, h)
	if err != nil {
		panic(err)
	}
}
type MuxedGrpc struct {
}