Skip to content

Commit

Permalink
Fix return values
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Nov 7, 2024
1 parent 7c8cde8 commit f4a9ec7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/graphql/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ def query(new_query_object = nil, &lazy_load_block)
elsif @query_object.is_a?(Proc)
@query_object = @query_object.call
self.visibility&.query_configured(@query_object)
@query_object
else
@query_object || find_inherited_value(:query)
end
Expand Down Expand Up @@ -492,6 +493,7 @@ def mutation(new_mutation_object = nil, &lazy_load_block)
elsif @mutation_object.is_a?(Proc)
@mutation_object = @mutation_object.call
self.visibility&.mutation_configured(@query_object)
@mutation_object
else
@mutation_object || find_inherited_value(:mutation)
end
Expand All @@ -512,7 +514,7 @@ def subscription(new_subscription_object = nil, &lazy_load_block)
raise GraphQL::Error, "Second definition of `subscription(...)` (#{dup_defn.inspect}) is invalid, already configured with #{@subscription_object.inspect}"
elsif use_visibility_profile?
if block_given?
@subscription_object = new_subscription_object
@subscription_object = lazy_load_block
else
@subscription_object = new_subscription_object
self.visibility.subscription_configured(@subscription_object)
Expand All @@ -527,6 +529,7 @@ def subscription(new_subscription_object = nil, &lazy_load_block)
elsif @subscription_object.is_a?(Proc)
@subscription_object = @subscription_object.call
add_subscription_extension_if_necessary
self.visibility.subscription_configured(@subscription_object)
@subscription_object
else
@subscription_object || find_inherited_value(:subscription)
Expand Down Expand Up @@ -712,17 +715,22 @@ def get_fields(type, context = GraphQL::Query::NullContext.instance)
type.fields(context)
end

# Pass a custom introspection module here to use it for this schema.
# @param new_introspection_namespace [Module] If given, use this module for custom introspection on the schema
# @return [Module, nil] The configured namespace, if there is one
def introspection(new_introspection_namespace = nil)
if new_introspection_namespace
@introspection = new_introspection_namespace
# reset this cached value:
@introspection_system = nil
introspection_system
@introspection
else
@introspection || find_inherited_value(:introspection)
end
end

# @return [Schema::IntrospectionSystem] Based on {introspection}
def introspection_system
if !@introspection_system
@introspection_system = Schema::IntrospectionSystem.new(self)
Expand Down

0 comments on commit f4a9ec7

Please sign in to comment.