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

Import bug - Message from Capitalized package is mistaken for Nested Type #87

Open
boukeversteegh opened this issue Jun 10, 2020 · 0 comments
Labels
bug Something isn't working has test Has a (xfail) test that verifies the bugfix or feature low priority
Milestone

Comments

@boukeversteegh
Copy link
Collaborator

The compiler does not distinguish the following two cases:

package somepackage.Core;

message Message {}
package somepackage;

message Core {
  message Message {}
}

as they are both:

somepackage.Core.Message

Protoc (as far as I've been able to figure out) reports the full type name, but not which part of that is the package, and which is the real type (somepackage.Core: Message vs somepackage: Core.Message).

In 99% of cases, this will not be a problem, because if users will follow the Protobuf Style Guide, packages will be lowercase, and types CapitalCamelCase, and the distinction can be made based on that.

https://developers.google.com/protocol-buffers/docs/style#packages

Package name should be in lowercase, and should correspond to the directory hierarchy. e.g., if a file is in my/package/, then the package name should be my.package.

https://developers.google.com/protocol-buffers/docs/style?hl=cs-CZ#message-and-field-names

Use CamelCase (with an initial capital) for message names – for example, SongServerRequest. Use underscore_separated_names for field names (including oneof field and extension names) – for example, song_name.

Despite these style guides, there may be some users who are using Capitalized packages and for some reason cannot change the packages to lowercase.

Then, these packages will not be imported correctly from depending packages / messages.

boukeversteegh added a commit to boukeversteegh/python-betterproto that referenced this issue Jun 10, 2020
boukeversteegh added a commit to boukeversteegh/python-betterproto that referenced this issue Jun 11, 2020
@boukeversteegh boukeversteegh added bug Something isn't working low priority has test Has a (xfail) test that verifies the bugfix or feature labels Jul 12, 2020
@boukeversteegh boukeversteegh added this to the Better Types milestone Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has test Has a (xfail) test that verifies the bugfix or feature low priority
Projects
None yet
Development

No branches or pull requests

1 participant