Hi all,
I’m happy to announce the release of Ocaml-protoc-plugin version 6.1.0
Ocaml-protoc-pluginis a plugin for google’s protobuf compiler (protoc
) that generates an idomatic ocaml mapping and (de-)serialization functions based on .proto files. The library aims to be 100% compliant implementation of the protobuf specification.
The 6.1.0 (and 6.0.0) release introduces Json serialization and deserialization based on protobuffers guidelines and the ability to copy comments from .proto into ocaml generated code for improved documentation as well as numerous bug fixes and other improvements.
Full changelog since release 5.0.0
6.1.0: 2024-04-25
- Fix name resolution leading to wrongly mapped names
- Fix codegen bug causing the plugin to reject valid protobuf
- Add preliminary support for melange though disabling eager
evaluation of serialize and deserialize functions when not using
native or bytecode backends - Fix missing cflags when compiling test c stub
- Make Map tests compatible with older versions of protoc
- Fix negative integer test failues due to a bug in older versions of protobuf (google) c lib
6.0.0: 2024-04-13
New features
- Implement json serialization and deserialization (#5)
- Support special json mapping for google types (#9)
- Add deprecation annotations for deprecated fields, services etc (#8)
- Add option to prefix generated files with their package name
- Copy documentation from proto files into generated ocaml bindings
Bug fixes
- Fix file output name if files contains a ‘-’
- Resolve bug for Request/Response module aliases leading to
generating uncompilable code. (#21) - Fix codegen bug for messages without fields and setting
singleton_records = true (#20) - In Services, the package field is now correctly set to None if
the service if not defined in a package scope (#24)
Misc changes
- Unify serialization and deserialization spec and optimize oneof handling
- Simplify types used in code generation to improve readaility
- *Replace
val name': unit -> string
withval name: unit -> string
which will only return the full protobuf name - Optimize merge functions by applying eager evaluation
- Change signature of
to_proto'
to return unit and not a writer
(*
indicates breaking change)
Notes
Message.name': unit -> string
has been renamed to Message.name: unit -> string
, and is now contains the fully qualified protobuf
message name. Before the name was the ocaml module name of the
message.
Service.Message
signature has been deprecated and replaced with
Spec.Message
signature. Service.Message
is now an alias for
Spec.Message
and will be removed in future releases.