File tree 1 file changed +10
-3
lines changed
common/src/main/java/dev/cel/common/values
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,20 @@ private ListValue<CelValue> adaptJsonListToCelValue(com.google.protobuf.ListValu
158
158
.collect (toImmutableList ()));
159
159
}
160
160
161
- // TODO: Investigate changing MapValue key to StringValue
162
- private MapValue < CelValue , CelValue > adaptJsonStructToCelValue ( Struct struct ) {
161
+ private MapValue < dev . cel . common . values . StringValue , CelValue > adaptJsonStructToCelValue (
162
+ Struct struct ) {
163
163
return ImmutableMapValue .create (
164
164
struct .getFieldsMap ().entrySet ().stream ()
165
165
.collect (
166
166
toImmutableMap (
167
- e -> fromJavaObjectToCelValue (e .getKey ()),
167
+ e -> {
168
+ CelValue key = fromJavaObjectToCelValue (e .getKey ());
169
+ if (!(key instanceof dev .cel .common .values .StringValue )) {
170
+ throw new IllegalStateException (
171
+ "Expected a string type for the key, but instead got: " + key );
172
+ }
173
+ return (dev .cel .common .values .StringValue ) key ;
174
+ },
168
175
e -> adaptJsonValueToCelValue (e .getValue ()))));
169
176
}
170
177
You can’t perform that action at this time.
0 commit comments