File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,9 @@ fn build_child_filter_from_object(
389389fn list_values ( value : Value , filter_type : & str ) -> Result < Vec < Value > , QueryExecutionError > {
390390 match value {
391391 Value :: List ( values) => {
392+ if values. is_empty ( ) {
393+ return Ok ( values) ;
394+ }
392395 // Check that all values in list are of the same type
393396 let root_discriminant = discriminant ( & values[ 0 ] ) ;
394397 for value in & values {
@@ -940,6 +943,26 @@ mod tests {
940943 )
941944 }
942945
946+ #[ test]
947+ fn build_query_handles_empty_in_list ( ) {
948+ let query_field = default_field_with (
949+ "where" ,
950+ r:: Value :: Object ( Object :: from_iter ( vec ! [ (
951+ "id_in" . into( ) ,
952+ r:: Value :: List ( vec![ ] ) ,
953+ ) ] ) ) ,
954+ ) ;
955+
956+ let result = query ( & query_field) ;
957+ assert_eq ! (
958+ result. filter,
959+ Some ( EntityFilter :: And ( vec![ EntityFilter :: In (
960+ "id" . to_string( ) ,
961+ Vec :: <Value >:: new( ) ,
962+ ) ] ) )
963+ ) ;
964+ }
965+
943966 #[ test]
944967 fn build_query_yields_block_change_gte_filter ( ) {
945968 let query_field = default_field_with (
You can’t perform that action at this time.
0 commit comments