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

ALL_CAPS message fields are parsed incorrectly. #11

Closed
acetylen opened this issue Jan 21, 2020 · 1 comment · Fixed by #88
Closed

ALL_CAPS message fields are parsed incorrectly. #11

acetylen opened this issue Jan 21, 2020 · 1 comment · Fixed by #88
Labels
bug Something isn't working has test Has a (xfail) test that verifies the bugfix or feature medium Medium effort issue, can fit in a single PR
Milestone

Comments

@acetylen
Copy link

$ cat filedata.proto
syntax = "proto3";
package filedata;

message FileData {
  uint32 FRAGMENT_NR = 1;
  bytes DATA = 2;
  uint64 UID = 3;
}

$ protoc --python_betterproto_out . filedata.proto
Writing __init__.py
Writing filedata.py
$ cat filedata.py
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: filedata.proto
# plugin: python-betterproto
from dataclasses import dataclass

import betterproto


@dataclass
class FileData(betterproto.Message):
    f_r_a_g_m_e_n_t__n_r: int = betterproto.uint32_field(1)
    d_a_t_a: bytes = betterproto.bytes_field(2)
    u_i_d: int = betterproto.uint64_field(3)
  • protoc 3.6.1
  • betterproto 1.2.2 (installed through pip)
  • python 3.7.3

I assume this has something to do with the parser thinking they are enums?

Rewriting our schema is unfortunately not an option, it's made to be backwards-compatible and encompasses thousands of fields over several hundred message types.

@danielgtaylor danielgtaylor added the bug Something isn't working label Jan 31, 2020
@danielgtaylor
Copy link
Owner

I suspect the case conversion code is broken. Nice catch!

@boukeversteegh boukeversteegh added the has test Has a (xfail) test that verifies the bugfix or feature label May 25, 2020
boukeversteegh added a commit to boukeversteegh/python-betterproto that referenced this issue May 25, 2020
boukeversteegh added a commit to boukeversteegh/python-betterproto that referenced this issue May 25, 2020
@boukeversteegh boukeversteegh added the medium Medium effort issue, can fit in a single PR label May 25, 2020
@boukeversteegh boukeversteegh added this to the Better Fields milestone May 25, 2020
boukeversteegh added a commit to boukeversteegh/python-betterproto that referenced this issue Jun 10, 2020
@boukeversteegh boukeversteegh linked a pull request Jun 10, 2020 that will close this issue
boukeversteegh added a commit to boukeversteegh/python-betterproto that referenced this issue Jun 11, 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 medium Medium effort issue, can fit in a single PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants