Closed alexec closed 2 years ago
@alexec I have a design forthcoming for optional values as a canonical extension of CEL. Give me a bit of time to put together the design doc in wiki form, but you can expect to see development in this direction in both the cel-go and cel-cpp repos.
The exact syntax will look as follows:
{
"specversion": "1.0",
"source": "intuit",
"id": event.source+"/"+event.id,
"type": event.type,
"datacontentype": "application/json",
"data": event.data,
// the following statements are equivalent to:
// "subject" = has(event.subject) ? optional.of(event.subject) : optional.none()
// where a value of optional.none() will ensure the value is unset in the result.
?"subject": event.?subject,
?"intuitaccountid": event.?intiuitaccountid,
}
I'm going to close this issue for now since it should be captured in #246 with the details present in https://github.com/google/cel-spec/wiki/proposal-246
Consider this CeL expression:
You'll see that it maps an input event to an output event (CloudEvent to be specific).
Some of the fields in the input event are optional and may not exist. Because CeL does not have a nill value, I insert empty strings. But really, I want those missing input fields to also be missing output fields. Essentially, I think I want to merge maps.