Skip to content

Problem with inner class names #344

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

Closed
M1s4k1 opened this issue Feb 23, 2022 · 4 comments · Fixed by #353
Closed

Problem with inner class names #344

M1s4k1 opened this issue Feb 23, 2022 · 4 comments · Fixed by #353

Comments

@M1s4k1
Copy link

M1s4k1 commented Feb 23, 2022

Proto:

message BattleEnd{
      bool is_win = 1; 
      message changed_player_exp{
          sint32 old_exp = 1; 
      }
      changed_player_exp changed_exp = 2; 
}

gen:

@dataclass(eq=False, repr=False)
class BattleEnd(betterproto.Message):
      is_win: bool = betterproto.bool_field(1)
      changed_exp: "BattleEndChangedPlayerExp" = betterproto.message_field(2)
  
@dataclass(eq=False, repr=False)
class BattleEndchangedPlayerExp(betterproto.Message):
      old_exp: int = betterproto.sint32_field(1)

"BattleEndChangedPlayerExp" and "BattleEndchangedPlayerExp" are different
There something wrong about camel case

@Gobot1234
Copy link
Collaborator

Gobot1234 commented Mar 11, 2022

This is expected behaviour, see https://developers.google.com/protocol-buffers/docs/style#message_and_field_names (which is why we do this)

@abn
Copy link
Collaborator

abn commented Mar 12, 2022

@Gobot1234 The current behaviour leads to errors as the type hint is different to class name, this bricks it. See test case in #353.

@M1s4k1
Copy link
Author

M1s4k1 commented Mar 12, 2022

thanks

@Gobot1234
Copy link
Collaborator

@Gobot1234 The current behaviour leads to errors as the type hint is different to class name, this bricks it. See test case in #353.

Sorry I didn't catch that

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

Successfully merging a pull request may close this issue.

3 participants