tokio-rs / prost

PROST! a Protocol Buffers implementation for the Rust Language
Apache License 2.0
3.78k stars 489 forks source link

`prost-types` crate missing Well Known Types from google.protobuf.wrapper #964

Closed adrianojsoares1 closed 7 months ago

adrianojsoares1 commented 8 months ago

I would like to know if this was an intentional design decision, or if google.protobuf.wrapper Well Known Types should be added to prost-types.

Summary

The README of prost-types suggests reviewing the official protocol buffers WKT documentation. However, there are several types listed in this documentation that are absent from prost-types. These include: BoolValue, BytesValue, DoubleValue, FloatValue, Int64Value, Int32Value, UInt32Value, UInt64Value, and StringValue. All of these can be traced back a single protofile definition - Google's wrappers.proto.

The definitions of these messages are not complicated, for example, Int64Value:

message Int64Value {
  int64 value = 1;
}

But they are available in Protocol Buffers packages of other languages. For example, in Python you could do:

from google.protobuf import wrappers_pb2
integer_message = wrappers_pb2.Int64Value(value=1)

I wonder, is there a particular reason these simple wrapper classes are missing, and should they be added to prost-types in a future release?

Suggestion

Generate Rust structs from the wrappers.proto definition to match the Protocol Buffers Well Known Types documentation.

mumbleskates commented 7 months ago

checkout src/types.rs in the main prost crate and you'll like what you find.