-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
Query 2020-06-15, Query 2020-06-29
This ticket will introduce three visitor types which derive from ‘MatchExpressionVisitor’, each of which have different responsibilities during error generation:
- ValidationErrorPreVisitor: This type will be responsible for generating errors, where each implementation of visit() will generate an error for a MatchExpression of that type. The implementations of non-leaf MatchExpressions will also allocate either a BSONObjBuilder or a BSONArrayBuilder for its children to use when generating an error.
- ValidationErrorInVisitor: This type will only have real implementations of visit() for non-leaf MatchExpressions, where each implementation is responsible for maintaining any state between visits to their children. For instance, if the current child of a ListOfMatchExpression finishes generating an error, visit() will need to add that error to the list of errors that is being tracked and create a new BSONObjBuilder for the next child error.
- ValidationErrorPostVisitor: This type will do any work needed to wrap up generating an error for the current node.
In addition to the three visitor types above, a ValidationErrorContext type will be introduced which tracks any runtime information needed by each of the visitors to produce a sensible error.