Add grpc_validator

This commit is contained in:
Nex 2020-06-16 15:12:53 +08:00
parent c2228d5601
commit 59f3e6a248
2 changed files with 9 additions and 2 deletions

View File

@ -13,10 +13,12 @@ for %%A in (%*) do (
if "%%A"=="go" ( if "%%A"=="go" (
set plugin=protoc-gen-go set plugin=protoc-gen-go
where /q !plugin! || echo Missing !plugin! && exit /b 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 set out=%gen%\go
if not exist !out! mkdir !out! if not exist !out! mkdir !out!
echo Generating Go code echo Generating Go code
!exec! --go_out=plugins=grpc:!out! %pbs% !exec! --go_out=plugins=grpc:!out! --govalidators_out=!out! %pbs%
) )
if "%%A"=="gohttp" ( if "%%A"=="gohttp" (
set plugin=protoc-gen-grpc-gateway set plugin=protoc-gen-grpc-gateway

View File

@ -36,12 +36,17 @@ do
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "missing plugin: $plugin" && exit echo "missing plugin: $plugin" && exit
fi fi
vplugin=protoc-gen-govalidators
which $vplugin > /dev/null
if [ $? -ne 0 ];then
echo "missing plugin: $vplugin" && exit
fi
out="$gen_dir/go" out="$gen_dir/go"
if [ ! -d $out ]; then if [ ! -d $out ]; then
mkdir -p $out mkdir -p $out
fi fi
echo "Generating Go code" 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 fi
if [ $aug == "gohttp" ]; then if [ $aug == "gohttp" ]; then
plugin=protoc-gen-grpc-gateway plugin=protoc-gen-grpc-gateway