@@ -274,7 +274,9 @@ module Ast =
274274 |> ValueOption.map _. TypeCondition
275275 |> ValueOption.defaultValue x.ParentType
276276
277- let private tryFindInArrayOption ( finder : 'T -> bool ) = ValueOption.ofOption >> ValueOption.bind ( Array.tryFind finder >> ValueOption.ofOption)
277+ let private tryFindInArrayOption ( finder : 'T -> bool ) =
278+ ValueOption.ofOption
279+ >> ValueOption.bind ( Array.tryFind finder >> ValueOption.ofOption)
278280
279281 let private onAllSelections ( ctx : ValidationContext ) ( onSelection : SelectionInfo -> ValidationResult < GQLProblemDetails >) =
280282 let rec traverseSelections selection =
@@ -360,7 +362,9 @@ module Ast =
360362 |> ValueOption.defaultValue List.empty
361363 | FragmentSpread fragSpread ->
362364 voption {
363- let! fragDef = ctx.FragmentDefinitions |> List.tryFind ( fun def -> def.Name.IsSome && def.Name.Value = fragSpread.Name)
365+ let! fragDef =
366+ ctx.FragmentDefinitions
367+ |> List.tryFind ( fun def -> def.Name.IsSome && def.Name.Value = fragSpread.Name)
364368 let! typeCondition = fragDef.TypeCondition
365369 let! fragType = ctx.Schema.TryGetTypeByName typeCondition
366370 let fragType = Spread ( fragSpread.Name, fragSpread.Directives, fragType)
@@ -898,10 +902,6 @@ module Ast =
898902 |> ValidationResult.collect ( checkFragmentSpreadIsPossibleInSelection))
899903
900904 let private checkInputValue ( schemaInfo : SchemaInfo ) ( variables : VariableDefinition list option ) ( selection : SelectionInfo ) =
901- let rec getFieldMap ( fields : ( string * IntrospectionTypeRef ) seq ) : Map < string , IntrospectionTypeRef > =
902- ( Map.empty, fields)
903- ||> Seq.fold ( fun acc ( name , tref ) -> Map.add name tref acc)
904-
905905 let rec checkIsCoercible ( tref : IntrospectionTypeRef ) ( argName : string ) ( value : InputValue ) =
906906 let canNotCoerce =
907907 AstError.AsResult (
@@ -954,8 +954,7 @@ module Ast =
954954 let fieldMap =
955955 itype.InputFields
956956 |> Option.defaultValue [||]
957- |> Array.map ( fun x -> x.Name, x.Type)
958- |> getFieldMap
957+ |> Array.fold ( fun acc inputVal -> Map.add inputVal.Name inputVal.Type acc) Map.empty
959958 let canCoerceFields =
960959 fieldMap
961960 |> ValidationResult.collect ( fun kvp ->
@@ -1401,7 +1400,8 @@ module Ast =
14011400 | ValueSome operationName, _ ->
14021401 AstError.AsResult
14031402 $" A variable '$%s {varDef.VariableName}' is not used in operation '%s {operationName}'. Every variable must be used."
1404- | ValueNone, _ -> AstError.AsResult $" A variable '$%s {varDef.VariableName}' is not used in operation. Every variable must be used." )
1403+ | ValueNone, _ ->
1404+ AstError.AsResult $" A variable '$%s {varDef.VariableName}' is not used in operation. Every variable must be used." )
14051405 | _ -> Success)
14061406
14071407 let rec private areTypesCompatible ( variableTypeRef : IntrospectionTypeRef ) ( locationTypeRef : IntrospectionTypeRef ) =
0 commit comments