@@ -76,7 +76,7 @@ type internal ObjectListFilterMiddleware<'ObjectType, 'ListType>(reportToMetadat
7676 let typesWithListFields =
7777 ctx.TypeMap.GetTypesWithListFields< 'ObjectType, 'ListType>()
7878 if Seq.isEmpty typesWithListFields
79- then failwith <| sprintf " No lists with specified type '%A ' where found on object of type '%A '. " typeof< 'ObjectType > typeof < ' ListType>
79+ then failwith $ " No lists with specified type '{typeof<'ObjectType>}' where found on object of type '{ typeof<'ListType>}'. "
8080 let modifiedTypes =
8181 typesWithListFields
8282 |> Seq.map ( fun ( object , fields ) -> modifyFields object fields)
@@ -85,8 +85,8 @@ type internal ObjectListFilterMiddleware<'ObjectType, 'ListType>(reportToMetadat
8585 next ctx
8686
8787 let reportMiddleware ( ctx : ExecutionContext ) ( next : ExecutionContext -> AsyncVal < GQLExecutionResult >) =
88- let rec collectArgs ( acc : KeyValuePair < string , ObjectListFilter > list ) ( fields : ExecutionInfo list ) =
89- let fieldArgs field =
88+ let rec collectArgs ( path : obj list ) ( acc : KeyValuePair < obj list , ObjectListFilter > list ) ( fields : ExecutionInfo list ) =
89+ let fieldArgs currentPath field =
9090 let filterResults =
9191 field.Ast.Arguments
9292 |> Seq.map ( fun x ->
@@ -99,29 +99,30 @@ type internal ObjectListFilterMiddleware<'ObjectType, 'ListType>(reportToMetadat
9999 | Ok filters ->
100100 filters
101101 |> removeNoFilter
102- |> Seq.map ( fun x -> KeyValuePair ( field.Ast.AliasOrName , x))
102+ |> Seq.map ( fun x -> KeyValuePair ( currentPath |> List.rev , x))
103103 |> Seq.toList
104104 |> Ok
105105 match fields with
106106 | [] -> Ok acc
107107 | x :: xs ->
108+ let currentPath = box x.Ast.AliasOrName :: path
108109 let accResult =
109110 match x.Kind with
110111 | SelectFields fields ->
111- collectArgs acc fields
112+ collectArgs currentPath acc fields
112113 | ResolveCollection field ->
113- fieldArgs field
114+ fieldArgs currentPath field
114115 | ResolveAbstraction typeFields ->
115116 let fields = typeFields |> Map.toList |> List.collect ( fun ( _ , v ) -> v)
116- collectArgs acc fields
117+ collectArgs currentPath acc fields
117118 | _ -> Ok acc
118119 match accResult with
119120 | Error errs -> Error errs
120- | Ok acc -> collectArgs acc xs
121+ | Ok acc -> collectArgs path acc xs
121122 let ctxResult = result {
122123 match reportToMetadata with
123124 | true ->
124- let! args = collectArgs [] ctx.ExecutionPlan.Fields
125+ let! args = collectArgs [] [] ctx.ExecutionPlan.Fields
125126 let filters = ImmutableDictionary.CreateRange args
126127 return { ctx with Metadata = ctx.Metadata.Add( " filters" , filters) }
127128 | false -> return ctx
0 commit comments