-
-
Notifications
You must be signed in to change notification settings - Fork 119
Description
for APIs that involve, say, DateTime (rather than custom message types) we should try to pick the most reasonable looking well-known-type and use that;
obvious candidates:
- DateTime / .google.protobuf.Timestamp (corelogic readily available in protobuf-net;
BclHelpers.ReadTimeStamp/WriteTimestamp) - TimeSpan / .google.protobuf.Duration (core logic readily available in protobuf-net;
BclHelpers.ReadDuration/WriteDuration) - void / .google.protobuf.Empty (already handled, but should migrate to the new
Emptyin protobuf-net)
the following probably already work fine (not sure about byte[]), as "assume a message with a single field with index 1" is the default behavior already:
- double / .google.protobuf.DoubleValue (wrappers.proto)
- float / .google.protobuf.FloatValue (wrappers.proto)
- long / .google.protobuf.Int64Value (wrappers.proto)
- ulong / .google.protobuf.UInt64Value (wrappers.proto)
- int / .google.protobuf.Int32Value (wrappers.proto)
- uint / .google.protobuf.UInt32Value (wrappers.proto)
- bool / .google.protobuf.BoolValue (wrappers.proto)
- string / .google.protobuf.StringValue (wrappers.proto)
- byte[] / .google.protobuf.BytesValue (wrappers.proto)
Note: with the above, we should probably hard remove the ability to opt in/out of data-contract types on the marshaller; it should be "nope, it is either something we recognize, or a data-contract type".
Note: we should also think about null in the above; since outer-most message don't include a length prefix, this could be awkward - since wrappers.proto is proto3, that means that there is no way of expressing a difference between 0 and null. Maybe we just don't support nulls ?
less obvious - the only ones I can see us even considering are Type and Api
- .google.protobuf.Any (any.proto) - mostly because I haven't seen this used to know the full intent
- .google.protobuf.Api (api.proto) - possibly maps to
Typewhen service-contract? - .google.protobuf.Type (type.proto) - possibly maps to
Typewhen data-contract? - .google.protobuf.FieldMask (field_mask.proto) - very bespoke; not implemented
- .google.protobuf.SourceContext (source_context.proto) - kinda like
Assemblymaybe? - .google.protobuf.Struct - think
Dictionary<string, .google.protobuf.Value> - .google.protobuf.Value - a catch all for several other types;
objectmaybe? or is thatAny?