Validate fragment spread target existence
This commit is contained in:
@ -163,7 +163,7 @@ type SelectionSetOpt = [Selection]
|
||||
-- @
|
||||
data Selection
|
||||
= Field (Maybe Alias) Name [Argument] [Directive] SelectionSetOpt
|
||||
| FragmentSpread Name [Directive]
|
||||
| FragmentSpread Name [Directive] Location
|
||||
| InlineFragment (Maybe TypeCondition) [Directive] SelectionSet
|
||||
deriving (Eq, Show)
|
||||
|
||||
|
@ -130,7 +130,7 @@ selection formatter = Lazy.Text.append indent' . encodeSelection
|
||||
field incrementIndent alias name args directives' selections
|
||||
encodeSelection (InlineFragment typeCondition directives' selections) =
|
||||
inlineFragment incrementIndent typeCondition directives' selections
|
||||
encodeSelection (FragmentSpread name directives') =
|
||||
encodeSelection (FragmentSpread name directives' _) =
|
||||
fragmentSpread incrementIndent name directives'
|
||||
incrementIndent
|
||||
| Pretty indentation <- formatter = Pretty $ indentation + 1
|
||||
|
@ -400,11 +400,12 @@ argument :: Parser Argument
|
||||
argument = Argument <$> name <* colon <*> value <?> "Argument"
|
||||
|
||||
fragmentSpread :: Parser Selection
|
||||
fragmentSpread = FragmentSpread
|
||||
<$ spread
|
||||
<*> fragmentName
|
||||
<*> directives
|
||||
<?> "FragmentSpread"
|
||||
fragmentSpread = label "FragmentSpread" $ do
|
||||
location <- getLocation
|
||||
_ <- spread
|
||||
fragmentName' <- fragmentName
|
||||
directives' <- directives
|
||||
pure $ FragmentSpread fragmentName' directives' location
|
||||
|
||||
inlineFragment :: Parser Selection
|
||||
inlineFragment = InlineFragment
|
||||
|
Reference in New Issue
Block a user