Skip to content

Use quotes for circular field definitions

Brett Walker requested to merge bw-graphql-quote-types into master

What does this MR do and why?

While converting to the new GraphQL interpreter, ran across a circular dependency with Types::GroupType, which would give

An error occurred while loading ./spec/graphql/resolvers/user_resolver_spec.rb.
Failure/Error: base.class_eval(&@_prepended_block)

NameError:
  uninitialized constant Types::EpicType::GroupType
  Did you mean?  Types::GroupType
                 GroupTree

Solution is to quote the type, from

field :group, Types::GroupType

to

field :group, 'Types::GroupType'

See https://github.com/rmosolgo/graphql-ruby/issues/1929#issuecomment-434037910

Related to #210556 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Brett Walker

Merge request reports

Loading