doesFragmentTypeApply function
bool
doesFragmentTypeApply(
- GraphQLObjectType objectType,
- TypeConditionNode fragmentType,
- GraphQLSchema schema
Implementation
bool doesFragmentTypeApply(
GraphQLObjectType objectType,
TypeConditionNode fragmentType,
GraphQLSchema schema,
) {
final type = convertType(fragmentType.on, schema.typeMap);
return type.whenMaybe(
object: (type) {
if (type.isInterface) {
return objectType.isImplementationOf(type);
} else {
return type.name == objectType.name;
}
},
union: (type) {
return type.possibleTypes.any((t) => objectType.isImplementationOf(t));
},
orElse: (_) => false,
);
}