From d3e101057247780583465db6c577799b6fe504b7 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Wed, 4 Dec 2024 14:39:43 -0600 Subject: [PATCH] Fix autoloading of GraphQL::Types Types reference schema, which reference types, so we need to take the part of schema that reference types, and autoload it. --- lib/graphql.rb | 1 + lib/graphql/schema.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/graphql.rb b/lib/graphql.rb index e2824ad19e..17eb3ed363 100644 --- a/lib/graphql.rb +++ b/lib/graphql.rb @@ -15,6 +15,7 @@ def self.eager_load! super Query.eager_load! Types.eager_load! + Schema.eager_load! end class Error < StandardError diff --git a/lib/graphql/schema.rb b/lib/graphql/schema.rb index a1963a0449..4c558023ba 100644 --- a/lib/graphql/schema.rb +++ b/lib/graphql/schema.rb @@ -75,6 +75,9 @@ module GraphQL class Schema extend GraphQL::Schema::Member::HasAstNode extend GraphQL::Schema::FindInheritedValue + extend Autoload + + autoload :BUILT_IN_TYPES, "graphql/schema/built_in_types" class DuplicateNamesError < GraphQL::Error attr_reader :duplicated_name @@ -1805,6 +1808,5 @@ module DefaultTraceClass end end -require "graphql/schema/built_in_types" require "graphql/schema/loader" require "graphql/schema/printer"