validateFragmentDataStructure function
Validates the structure of data
against the fragment fragmentName
in document
.
Throws a PartialDataException if the data is invalid,
unless handleException=true
, in which case it returns false
.
NOTE: while null
data is a theoretically acceptable value for any fragment in isolation,
we treat it as invalid here, maintaining consistency with denormalizeOperation.
Calls denormalizeFragment internally.
Implementation
bool validateFragmentDataStructure({
required DocumentNode document,
required Map<String, dynamic>? data,
String? fragmentName,
Map<String, dynamic> variables = const {},
bool addTypename = false,
bool handleException = false,
}) {
return _validateSelectionSet(
document: document,
getSelectionSet: ({required document, required fragmentMap}) {
return findFragmentInFragmentMap(
fragmentMap: fragmentMap,
fragmentName: fragmentName,
).selectionSet;
},
data: data,
variables: variables,
addTypename: addTypename,
handleException: handleException,
);
}