File tree 3 files changed +15
-5
lines changed
3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -133,17 +133,16 @@ let gen_rft_variant sc rf_label { Ot.v_constructors; _ } =
133
133
let json_label =
134
134
Pb_codegen_util. camel_case_of_constructor vc_constructor
135
135
in
136
- F. linep sc " | %s v ->" vc_constructor;
137
136
F. sub_scope sc (fun sc ->
138
137
match vc_field_type with
139
138
| Ot. Vct_nullary ->
140
- F. linep sc " (\" %s\" , `Null) :: assoc" json_label
139
+ F. linep sc " | %s -> (\" %s\" , `Null) :: assoc" vc_constructor json_label
141
140
| Ot. Vct_non_nullary_constructor field_type ->
142
141
(match
143
142
gen_field var_name json_label field_type vc_payload_kind
144
143
with
145
- | None -> F. linep sc " (\" %s\" , `Null) :: assoc" json_label
146
- | Some exp -> F. linep sc " %s :: assoc " exp)))
144
+ | None -> F. linep sc " | %s -> (\" %s\" , `Null) :: assoc" vc_constructor json_label
145
+ | Some exp -> F. linep sc " | %s v -> %s :: assoc" vc_constructor exp)))
147
146
v_constructors);
148
147
149
148
F. linep sc " in (* match v.%s *)" rf_label
Original file line number Diff line number Diff line change 8
8
(deps
9
9
(:file yojson_unittest.proto))
10
10
(action
11
- (run %{project_root}/src/ocaml-protoc/ocaml_protoc.exe %{file} --yojson
11
+ (run %{project_root}/src/ocaml-protoc/ocaml_protoc.exe %{file} --yojson --pp
12
12
--ml_out=.)))
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ message AllBasicTypes {
27
27
repeated string repeated14 = 34 ;
28
28
}
29
29
30
+ message Empty {}
31
+
30
32
message SmallMessage {
31
33
string sm_string = 1 ;
32
34
}
@@ -74,3 +76,12 @@ message Test {
74
76
repeated Enum repeated_enum = 10 ;
75
77
repeated ABasicMessage basic = 11 ;
76
78
}
79
+
80
+ message NestedUnit {
81
+ oneof yolo {
82
+ int32 x = 1 ;
83
+ Empty empty = 2 ;
84
+ }
85
+
86
+ string other = 3 ;
87
+ }
You can’t perform that action at this time.
0 commit comments