Skip to content

oneof fields are not handled properly #21

Open
@mechterp10

Description

@mechterp10

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugProblems in the build system, build scripts, etc or faults in the interface.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions