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

oneof fields are not handled properly #21

Open
mechterp10 opened this issue Mar 29, 2022 · 0 comments
Open

oneof fields are not handled properly #21

mechterp10 opened this issue Mar 29, 2022 · 0 comments
Labels
bug Problems in the build system, build scripts, etc or faults in the interface.

Comments

@mechterp10
Copy link

Example

Input

syntax = "proto3";

package test;

message SubType {
    enum Type {
        TYPE_1 = 0;
        TYPE_2 = 1;
    }

    Type field_1 = 1;
    uint64 field_2 = 2;

    oneof OneOfField {
        int32 field_3 = 3;
        double field_6 = 6;
    }
}

Output

syntax = "proto3";
namespace test {
struct SubType {
enum Type {
TYPE_1 = 0,
TYPE_2 = 1,
};
Type field_1 = 1;
uint64 field_2 = 2;
oneof OneOfField {
int32 field_3 = 3;
double field_6 = 6;
};
};
}

In documentation, one would expect that field_3 could be referenced as test::SubType::field_3 or test::SubType::OneOfField::field_3. However, the field is not accessible as oneof is not a C++ type.

Once the style is chosen (i.e, test::SubType3::field_3 or test::SubType3::OneOfField::field_3) the fix is relatively simple.

@mechterp10 mechterp10 added the bug Problems in the build system, build scripts, etc or faults in the interface. label Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problems in the build system, build scripts, etc or faults in the interface.
Projects
None yet
Development

No branches or pull requests

1 participant