Skip to content

json tags not set for oneof fields #140

Closed
@tyleradams

Description

@tyleradams

A struct like

message A {
  optional string e = 3;
  oneof b {
    string c = 1;
    string d = 2;
  }
}

Generates the following go code

type A struct {
  E *E `protobuf:"bytes,3,opt,name=e" json:"e,omitempty"`
  // Types that are valid to be assigned to B
  //   * B_C
  //   * B_D
  B   isA_B `protobuf_oneof:"value"`
}
...
type struct {
  C string `protobuf:"bytes,1,opt,name=c,oneof"`
}

type struct {
  D string `protobuf:"bytes,2,opt,name=d,oneof"`
}
...

The oneof field structs should also have json go tags so they can serialize to JSON correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions