anchor.diff:                  match operation.Name with
                   | Some operationName -> sprintf "%s operation '%s' has a directive '%s', but this directive location is not supported by the schema definition." (operation.OperationType.ToString()) operationName directiveDef.Name
                   | None -> sprintf "This %s operation has a directive '%s', but this directive location is not supported by the schema definition." (operation.OperationType.ToString()) directiveDef.Name))
  -        let operationsValid =
  +        let directivesValidInSelectionSet =
               operation.SelectionSet
  -            |> collectResults (checkDirectivesInValidLocationOnSelection schemaInfo fragmentDefinitions path visitedFragments)
  -        directivesValid @@ operationsValid
  +            |> collectResults (checkDirectivesInValidLocationOnSelection schemaInfo fragmentDefinitions path)
  +        directivesValid @@ directivesValidInSelectionSet
   
       let internal validateDirectivesAreInValidLocations (ctx : ValidationContext) =
           let fragmentDefinitions = ctx.FragmentDefinitions |> List.map (fun x -> x.Definition)
  -        let visitedFragments = ref []
           ctx.Document.Definitions
           |> collectResults (fun def ->
               let path = def.Name |> Option.toList
               match def with
  -            | OperationDefinition odef -> checkDirectivesInOperation ctx.Schema fragmentDefinitions path visitedFragments odef
  -            | FragmentDefinition frag -> checkDirectivesInFragment ctx.Schema fragmentDefinitions path visitedFragments frag)
  +            | OperationDefinition odef -> 
  +                checkDirectivesInOperation ctx.Schema fragmentDefinitions path odef
  +            | FragmentDefinition frag when frag.Name.IsSome ->
  +                let fragCtx =
  +                    { Schema = ctx.Schema
  +                      FragmentDefinitions = fragmentDefinitions
  +                      Path = path
  +                      FragmentName = frag.Name.Value
  +                      Directives = frag.Directives
  +                      SelectionSet = frag.SelectionSet }
  +                checkDirectivesInValidLocationOnFragmentSpread fragCtx
  +            | _ -> Success)
   
       let rec private getDirectiveNamesInSelection (path : Path) (selection : Selection) : (Path * string list) list =
           match selection with
  
positive.code:                 odef.SelectionSet
                  |> collectResults (fragmentSpreadTargetDefinedInSelection fragmentDefinitionNames path))
  
      let rec private checkFragmentMustNotHaveCycles (fragmentDefinitions : FragmentDefinition list) (visited : string list ref) (validated : string list ref) (frag : FragmentDefinition) =
          frag.Name
          |> Option.map (fun name ->
              if List.contains name !visited
              then
                  if not (List.contains name !validated) then
                      validated := name :: !validated
                      AstError.AsResult(sprintf "Fragment '%s' is making a cyclic reference." name)
                  else Success
              else
                  visited := name :: !visited
                  frag.SelectionSet
                  |> collectResults (checkFragmentsMustNotHaveCyclesInSelection fragmentDefinitions (ref !visited) (ref !validated)))
          |> Option.defaultValue Success
  
      and private checkFragmentsMustNotHaveCyclesInSelection (fragmentDefinitions : FragmentDefinition list) (visited : string list ref) (validated : string list ref) =
          function
          | Field field ->
              field.SelectionSet
              |> collectResults (checkFragmentsMustNotHaveCyclesInSelection fragmentDefinitions (ref !visited) (ref !validated))
          | InlineFragment frag -> checkFragmentMustNotHaveCycles fragmentDefinitions visited validated frag
          | FragmentSpread spread ->
              match fragmentDefinitions |> List.tryFind (fun f -> f.Name.IsSome && f.Name.Value = spread.Name) with
              | Some frag -> checkFragmentMustNotHaveCycles fragmentDefinitions visited validated frag
              | None -> Success
  
      let internal validateFragmentsMustNotFormCycles (ctx : ValidationContext) =
          let fragmentDefinitions = ctx.FragmentDefinitions |> List.map (fun x -> x.Definition)
          fragmentDefinitions
          |> collectResults (fun x -> checkFragmentMustNotHaveCycles fragmentDefinitions (ref []) (ref []) x)
  
      let private checkFragmentSpreadIsPossibleInSelection (path : Path, parentType : IntrospectionType, fragmentType : IntrospectionType) =
          if not (typesAreApplicable (parentType, fragmentType))
  
negative.code:                                 FragmentType = None
                                  Path = fieldPath
                                  SelectionSet = field.SelectionSet }
                          getSelectionSetInfo visitedFragments fieldCtx)
                      |> Option.defaultValue []
                  { Field = field
                    SelectionSet = fieldSelectionSet
  