zig-protobuf icon indicating copy to clipboard operation
zig-protobuf copied to clipboard

Support proto files without package names

Open Arwalk opened this issue 2 months ago • 3 comments

closes #57

This adds our first option for the plugin, paving the way for more cool things later.

Arwalk avatar Oct 13 '25 19:10 Arwalk

Ok to merge this as-is @menduz ? Or should i look a bit more into it ?

Arwalk avatar Oct 19 '25 09:10 Arwalk

I think the current implementation has an issue with the visibility of the imported packets (https://github.com/Arwalk/zig-protobuf/pull/141#discussion_r2429910089). While declaring one import as public, AND having that import using a proper package name. If we reuse the name for the "package-less" imports, then the generated code is not marked as pub const, effectively shadowing its public flag.

I would choose to continue with a caveat in the readme about "Package-less imports are not supported yet" rather than introducing the described corner case

menduz avatar Oct 19 '25 17:10 menduz

I think the problem existed before this PR (all our imports are marked as public in all.proto but most of them are not pub at the end). But you're right that i should still look into it before. It's not a critical thing for now.

Arwalk avatar Oct 27 '25 14:10 Arwalk