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

Enabling 'include_imports' in protoc build command broken (or documentation gap) #1366

Closed
martijnjanssen opened this issue Dec 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@martijnjanssen
Copy link

Updating all dependencies (@bufbuild/protobuf, @bufbuild/protoc-gen-es, @connectrpc/connect, @connectrpc/connect-web) to V2 results in the error Could not resolve "./buf/validate/validate_pb". From the migration guide it is very clear that this issue is to be resolved by setting include_imports: true in the buf.build file. Great!

What is missing is how to include it in a protoc build command. I cannot figure out how to correctly enable that setting from the cli.

protoc \
	-I. \
	-I./bufbuild/protoc-gen-validate \
	-I./proto \
--plugin ./node_modules/.bin/protoc-gen-es \
--es_out ./proto \
--es_opt target=ts \
--es_include_imports \
*.proto

Results in the error:
Unknown flag: --es_include_imports

I cannot seem to figure out how to set it, or it is broken, given how new the setting is.

@martijnjanssen martijnjanssen added the bug Something isn't working label Dec 10, 2024
@martijnjanssen martijnjanssen changed the title Documentation for enabling 'include_imports' in protoc build command Enabling 'include_imports' in protoc build command broken (or documentation gap) Dec 10, 2024
@srikrsna-buf
Copy link
Member

include_imports is a feature of buf and is not part of the plugin. For protoc you will have to generate code for validate files as well:

cd ./bufbuild/protoc-gen-validate
protoc \
	-I. \
--plugin ../../node_modules/.bin/protoc-gen-es \
--es_out ../../proto \
--es_opt target=ts \
**/*.proto

@martijnjanssen
Copy link
Author

Right, that helps a lot. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants