code: def _validate_recurse_directive_types(current_schema_type, field_schema_type, context):
      
      # Get the set of all allowed types in the current scope.
      type_hints = context['type_equivalence_hints'].get(field_schema_type)
      type_hints_inverse = context['type_equivalence_hints_inverse'].get(field_schema_type)
      allowed_current_types = {field_schema_type}
  
      if type_hints and isinstance(type_hints, GraphQLUnionType):
          allowed_current_types.update(type_hints.types)
  
      if type_hints_inverse and isinstance(type_hints_inverse, GraphQLUnionType):
          allowed_current_types.update(type_hints_inverse.types)
  
      # The current scope must be of the same type as the field scope, or an acceptable subtype.
      current_scope_is_allowed = current_schema_type in allowed_current_types
  
      is_implemented_interface = (
          isinstance(field_schema_type, GraphQLInterfaceType) and
          isinstance(current_schema_type, GraphQLObjectType) and
          field_schema_type in current_schema_type.interfaces
      )
  
      if not any((current_scope_is_allowed, is_implemented_interface)):
          raise GraphQLCompilationError(u'Edges expanded with a @recurse directive must either '
                                        u'be of the same type as their enclosing scope, a supertype '
                                        u'of the enclosing scope, or be of an interface type that is '
                                        u'implemented by the type of their enclosing scope. '
                                        u'Enclosing scope type: {}, edge type: '
                                        u'{}'.format(current_schema_type, field_schema_type))
docs: Perform type checks on the enclosing type and the recursed type for a recurse directive.
  
      Args:
          current_schema_type: GraphQLType, the schema type at the current location
          field_schema_type: GraphQLType, the schema type at the inner scope
          context: dict, various per-compilation data (e.g. declared tags, whether the current block
                   is optional, etc.). May be mutated in-place in this function!