Validate all fragments are used
This commit is contained in:
@ -85,8 +85,8 @@ selection :: forall m. Selection -> ValidateT m
|
||||
selection selection'
|
||||
| FragmentSpreadSelection fragmentSelection <- selection' =
|
||||
visitChildSelections ruleFilter $ fragmentSpread fragmentSelection
|
||||
| Field _ _ _ _ selectionSet _ <- selection' =
|
||||
visitChildSelections ruleFilter $ traverseSelectionSet selectionSet
|
||||
| FieldSelection fieldSelection <- selection' =
|
||||
visitChildSelections ruleFilter $ field fieldSelection
|
||||
| InlineFragmentSelection fragmentSelection <- selection' =
|
||||
visitChildSelections ruleFilter $ inlineFragment fragmentSelection
|
||||
where
|
||||
@ -94,6 +94,14 @@ selection selection'
|
||||
mapReaderT (runRule accumulator) $ rule selection'
|
||||
ruleFilter accumulator _ = pure accumulator
|
||||
|
||||
field :: forall m. Field -> ValidateT m
|
||||
field field'@(Field _ _ _ _ selections _) =
|
||||
visitChildSelections ruleFilter $ traverseSelectionSet selections
|
||||
where
|
||||
ruleFilter accumulator (FieldRule rule) =
|
||||
mapReaderT (runRule accumulator) $ rule field'
|
||||
ruleFilter accumulator _ = pure accumulator
|
||||
|
||||
inlineFragment :: forall m. InlineFragment -> ValidateT m
|
||||
inlineFragment fragment@(InlineFragment _ _ selections _) =
|
||||
visitChildSelections ruleFilter $ traverseSelectionSet selections
|
||||
|
Reference in New Issue
Block a user