Skip to content

Commit 63bea0f

Browse files
committed
Docs
1 parent fc560d1 commit 63bea0f

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

conformance/expected-failures.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +0,0 @@
1-
custom_rules:
2-
- field_expression/map/enum/invalid
3-
- field_expression/map/enum/valid
4-
- field_expression/map/message/invalid
5-
- field_expression/map/message/valid
6-
- field_expression/map/bool/valid
7-
- field_expression/map/bool/invalid
8-
- field_expression/map/string/valid
9-
- field_expression/map/string/invalid
10-
- field_expression/map/int32/valid
11-
- field_expression/map/int32/invalid
12-
- field_expression/map/uint32/valid
13-
- field_expression/map/uint32/invalid
14-
- field_expression/map/int64/valid
15-
- field_expression/map/int64/invalid
16-
- field_expression/map/uint64/valid
17-
- field_expression/map/uint64/invalid

src/main/java/build/buf/protovalidate/ObjectValue.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Message messageValue() {
6565
public <T> T value(Class<T> clazz) {
6666
Descriptors.FieldDescriptor.Type type = fieldDescriptor.getType();
6767
if (fieldDescriptor.isMapField()) {
68-
return clazz.cast(getMapBinding());
68+
return clazz.cast(mapValueAsObject());
6969
}
7070
if (!fieldDescriptor.isRepeated()
7171
&& (type == Descriptors.FieldDescriptor.Type.UINT32
@@ -96,10 +96,18 @@ public List<Value> repeatedValue() {
9696
return out;
9797
}
9898

99-
// TODO - This is essentially the same functionality as `mapValue` except that it
100-
// returns a Map of Objects rather than a Map of protovalidate-java Value.
101-
// Trying to bind a Map of Values to a CEL variable (i.e. `this`) does not work
102-
// because CEL-Java doesn't know how to interpret that proprietary Value object.
99+
// TODO - This should be refactored at some point.
100+
//
101+
// This is essentially the same functionality as `mapValue` except that it
102+
// returns a Map of Objects rather than a Map of protovalidate-java Values.
103+
// It is used for binding to a CEL variable (i.e. `this`).
104+
// Trying to bind a Map of Values to a CEL variable does not work because
105+
// CEL-Java doesn't know how to interpret that proprietary Value object.
106+
//
107+
// Ideally, we should be using CEL-Java's org.projectnessie.cel.common.types.ref.Val
108+
// type instead of our own custom Value abstraction. However, since we are evaluating
109+
// Java CEL implementations, we should probably wait until that decision is made before
110+
// making such a large refactor. This should suffice as a stopgap until then.
103111
private Map<Object, Object> mapValueAsObject() {
104112
List<AbstractMessage> input =
105113
value instanceof List

0 commit comments

Comments
 (0)