# frozen_string_literal: true

require "graphql/client/definition"
require "graphql/client/deprecation"

module GraphQL
  class Client
    # Specific fragment definition subtype.
    class FragmentDefinition < Definition
      def new(obj, *args)
        if obj.is_a?(Hash)
          GraphQL::Client::Deprecation.warn("constructing fragment wrapper from Hash is deprecated")
        end

        super
      end
    end
  end
end

# frozen_string_literal: true

require "graphql/client/definition"
require "graphql/client/deprecation"

module GraphQL
  class Client
    # Specific fragment definition subtype.
    class FragmentDefinition < Definition
      def new(obj, *args)
        if obj.is_a?(Hash)
          raise TypeError, "constructing fragment wrapper from Hash is deprecated"
        end

        super
      end
    end
  end
end

Raise error when fragment definitions are used with hashes
Raise error when fragment definitions are used with hashes
