This has become more painful because of the introduction of CEL, but request.time is made available as the struct that backs it:
map[nanos:68000 seconds:1.730319299e+09]. With CEL having first class support it is probably expected (and documented) to be available as a proper Timestamp. Even in JSON tho, it would be probably be best represented in RFC3339 format.
Proposal
protojson deals with these conversions properly. Which is already used to produce the intermediary JSON result coming back from a CEL Value, as well as feeding out WellKnownAttributes into the interpreter. request itself is protobuf as it comes from envoy/service/auth/v3's AttributeContext which is autogenerated from a .proto.
I'm thinking we should have our own WellKnownAttributes spec'ed as protobuf and use protojson to marshal that data. With that approach, no json marshaling would actually to inject the WellKnownAttributes into the CEL interpreter, but they would be made available as protobuf Messages directly.
So the proposal is to refactor all of WellKnownAttributes into .proto, and use that generated code to produce proper typed JSON/CEL Values. wdyt?
This has become more painful because of the introduction of CEL, but
request.timeis made available as the struct that backs it:map[nanos:68000 seconds:1.730319299e+09]. With CEL having first class support it is probably expected (and documented) to be available as a properTimestamp. Even in JSON tho, it would be probably be best represented in RFC3339 format.Proposal
protojsondeals with these conversions properly. Which is already used to produce the intermediary JSON result coming back from a CEL Value, as well as feeding outWellKnownAttributesinto the interpreter.requestitself is protobuf as it comes fromenvoy/service/auth/v3'sAttributeContextwhich is autogenerated from a.proto.I'm thinking we should have our own
WellKnownAttributesspec'ed as protobuf and useprotojsonto marshal that data. With that approach, no json marshaling would actually to inject theWellKnownAttributesinto the CEL interpreter, but they would be made available as protobufMessages directly.So the proposal is to refactor all of
WellKnownAttributesinto.proto, and use that generated code to produce proper typed JSON/CEL Values. wdyt?