danielgtaylor / danielgtaylor/python-betterproto

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

Abierto
#87 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug has test low priority
Lenguaje dominante
Python
Estrellas
1.8k
Forks
234
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

The compiler does not distinguish the following two cases:

```protobuf
package somepackage.Core;

message Message {}
```

```protobuf
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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.