Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang=GOGO. Can not sets custom mapping for validator. #198

Open
gebv opened this issue Sep 5, 2020 · 1 comment
Open

lang=GOGO. Can not sets custom mapping for validator. #198

gebv opened this issue Sep 5, 2020 · 1 comment

Comments

@gebv
Copy link

gebv commented Sep 5, 2020

My code

PROTOC_MAP ?= Mmy/shared/proto/files.proto=github.com/my/shared/proto/files,Mmy/shared/proto/files.proto=github.com/my/shared/proto/files

PROTOC ?= docker run --rm -u ${shell id -u} \
	-v ${PWD}:/defs namely/protoc-all:1.29_1 \
	-l gogo \
	--go-package-map ${PROTOC_MAP} \
	--with-validator \
	-o ./ \
	-i ./proto

$(PROTOC) \
		-d ./proto/path/to/proto/file

I think this is the problem - can not possible sets mapping for validation

GEN_STRING="$GEN_STRING --govalidators_out=gogoimport=true:$OUT_DIR"

My quick solution is to replace local paths imports to global paths
Similar code

find ${PWD}/path/to/gen/proto/files \
		-name '*.pb.validate.go' \
		-exec \
			sed \
				-i.bak \
				's/generatedlocalpath/globalpath/g' \
				{} +
	find ${PWD}/path/to/gen/proto/files \
		-name '*.bak' \
		-exec \
			rm {} +
@ido-namely
Copy link
Contributor

Hi @gebv,
Sorry for the late response.
Would you mind confirming this is still an issues with out latest released images?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants