From 59f3e6a24835e23520530f2c88c9fb370e3cc7ce Mon Sep 17 00:00:00 2001 From: Nex Date: Tue, 16 Jun 2020 15:12:53 +0800 Subject: [PATCH] Add grpc_validator --- grpc/scripts/gen.bat | 4 +++- grpc/scripts/gen.sh | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/grpc/scripts/gen.bat b/grpc/scripts/gen.bat index b67ac33..59196a1 100644 --- a/grpc/scripts/gen.bat +++ b/grpc/scripts/gen.bat @@ -13,10 +13,12 @@ for %%A in (%*) do ( if "%%A"=="go" ( set plugin=protoc-gen-go where /q !plugin! || echo Missing !plugin! && exit /b + set vplugin=protoc-gen-govalidators + where /q !vplugin! || echo Missing !vplugin! && exit /b set out=%gen%\go if not exist !out! mkdir !out! echo Generating Go code - !exec! --go_out=plugins=grpc:!out! %pbs% + !exec! --go_out=plugins=grpc:!out! --govalidators_out=!out! %pbs% ) if "%%A"=="gohttp" ( set plugin=protoc-gen-grpc-gateway diff --git a/grpc/scripts/gen.sh b/grpc/scripts/gen.sh index f1f56d6..c9a82d1 100755 --- a/grpc/scripts/gen.sh +++ b/grpc/scripts/gen.sh @@ -36,12 +36,17 @@ do if [ $? -ne 0 ];then echo "missing plugin: $plugin" && exit fi + vplugin=protoc-gen-govalidators + which $vplugin > /dev/null + if [ $? -ne 0 ];then + echo "missing plugin: $vplugin" && exit + fi out="$gen_dir/go" if [ ! -d $out ]; then mkdir -p $out fi echo "Generating Go code" - $exec --go_out=plugins=grpc:$out $pb_files $async_tag + $exec --go_out=plugins=grpc:$out --govalidators_out=$out $pb_files $async_tag fi if [ $aug == "gohttp" ]; then plugin=protoc-gen-grpc-gateway