Commit 95faaa8
committed
Preserve FieldMask as a message in the CelValue runtime path
BaseProtoCelValueConverter.fromWellKnownProto converts FieldMask to a
comma-separated string of its paths. That's correct in JSON-assignment
contexts (handled separately by CelProtoJsonAdapter), but it breaks CEL
expressions that access fields on the FieldMask itself — e.g.
`fieldMask.paths` — because the string has no field `paths`.
The CEL spec's WKT conversion table does not list FieldMask. cel-go
treats it as a regular message, as does cel-java's legacy
ProtoLiteAdapter.adaptValueToWellKnownProto for non-JSON contexts.
Override fromWellKnownProto in ProtoCelValueConverter to preserve
FieldMask as a ProtoMessageValue. JSON-assignment paths (e.g.
TestAllTypes{single_value: FieldMask{...}}) are unaffected because
EvalCreateStruct and CelValueRuntimeTypeProvider.createMessage both
unwrap StructValue results before the outer assignment runs, and the
outer assignment goes through CelProtoJsonAdapter.adaptValueToJsonValue
which handles FieldMask → string conversion at that layer.1 parent 98ce0bf commit 95faaa8
2 files changed
Lines changed: 21 additions & 0 deletions
File tree
- common/src
- main/java/dev/cel/common/values
- test/java/dev/cel/common/values
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
306 | 324 | | |
307 | 325 | | |
308 | 326 | | |
| |||
0 commit comments