Skip to content

Commit

Permalink
Add support for bytes in JSON encoding
Browse files Browse the repository at this point in the history
Tested with:
https://github.com/etcd-io/etcd/blob/main/api/mvccpb/kv.proto
https://github.com/etcd-io/etcd/blob/main/api/etcdserverpb/rpc.proto

This depends on a newer ocaml-protoc-yojson that supports bytes,
encoded as base64.

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok authored and c-cube committed Aug 12, 2023
1 parent 0c1699b commit 69ec51a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compilerlib/pb_codegen_encode_yojson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let runtime_function_for_basic_type json_label basic_type pk =
(* bool *)
| Ot.Bt_bool, Ot.Pk_varint _ -> "make_bool", None
(* bytes *)
| Ot.Bt_bytes, Ot.Pk_bytes -> unsupported json_label
| Ot.Bt_bytes, Ot.Pk_bytes -> "make_bytes", None
| _ -> unsupported json_label

(* TODO Wrapper: add a runtime_function_for_wrapper_type which will
Expand Down

0 comments on commit 69ec51a

Please sign in to comment.