Analyzer::Ruby::Graphql
Inherits Analyzer::Ruby::RubyEngine < Analyzer < FileHelper < Reference < Object
graphql-ruby (code-first GraphQL). The schema lives in Ruby classes, not
SDL: class AppSchema < GraphQL::Schema binds query Types::QueryType
(and mutation/subscription), and each root type declares
field :post, PostType do argument :id, ID end, or delegates to a
resolver: / mutation: class that declares its own arguments. Each
root field becomes one endpoint in the shape the SDL analyzers emit.
Two passes: every .rb file is line-scanned into class/module bodies
(fields, arguments, includes, superclass), then roots, resolvers and
mixins are resolved across files by constant name. Class bodies are
closed by indentation, which holds for conventionally formatted Ruby.
Constants
A field whose return type is a *Connection gets these four arguments.
A file carries something this analyzer reads only if it names graphql-ruby, declares a field/argument, or routes to a GraphQL controller.
Rails: post "/graphql", to: "graphql#execute" (or the => form).
include GraphQL::Types::Relay::HasNodeField / HasNodesField (or the
legacy add_field GraphQL::Types::Relay::NodeField) add these fields.
Ruby class names graphql-ruby maps to built-in scalars.
Class methods
Instance methods
Instance-side view of the same declaration. The per-file rescues live on
this base class, which has no way to name the analyzer that is running
inside them, so a skipped file could not be attributed to a tech.
Deriving it from analyzer_for keeps the name written exactly once.