Table of Contents


Several features of this gem can be changed to better adapt to your needs. You can change any of the items listed here as follows:

# config/initializer/graphql.rb
Rails::GraphQL.configure do |gql|
  gql.version = 'ABCDEFG'


This helps to keep track of when things were cached and registered. Cached objects with mismatching versions need to be upgraded or simply reloaded. An excellent way to use this is to set it to the commit hash. TypePap will always use only the first 8 characters for simplicity.

Default: nil


The instance responsible for caching all the information generated by requests and all the other components. Manually setting this property means that the object in it complies with ActiveSupport::Cache::Store. This will map automatically to Rails.cache if kept as nil. This can also be set per Schema.

Default: nil


If Rails cache is not properly defined or just set to use a NullStore, this fallback will set itself up with a memory store because cache is crucial, especially for subscriptions.


-> { nil) }


This is the prefix key of all the cache entries for the GraphQL cached things.

Default: 'graphql/'


The list of nested paths inside of the GraphQL folder that does not require to be in their own namespace.


  "directives", "fields", "sources", "enums", "inputs",
  "interfaces", "object", "scalars", "unions",


This is very similar to ActiveRecord verbose logs, which simply show the path of the file that started a GraphQL request.

Default: true


The list of parameters to omit from the logger when running a GraphQL request. Those values are displayed better in the internal runtime logger controller.

Default: ["query", "operationName", "operation_name", "variables", "graphql"]


Identical to the one available on a Rails application, but exclusive for GraphQL operations. The list of parameters to display as filtered in the logs. When it is nil, it will use the same as the Rails application.

Default: nil


A list of all ActiveRecord adapters supported. When an adapter is supported, it will map the database types into GraphQL types using proper aliases. Plus, it will have the method to map models attributes to their equivalent fields.


  'Mysql2'     => { key: :mysql,  path: "#{__dir__}/adapters/mysql_adapter" },
  'PostgreSQL' => { key: :pg,     path: "#{__dir__}/adapters/pg_adapter" },
  'SQLite'     => { key: :sqlite, path: "#{__dir__}/adapters/sqlite_adapter" },


The suffix that is added automatically to all the Input type objects. This prevents situations like PointInputInput. If your inputs have a different suffix, change this value to it.

Default: 'Input'


Set if the server should allow strings be used as input for ENUM inputs. It means that operations will support quotes for ENUM values embedded in the documents.

Default: false


Introspection is enabled by default. It is recommended to only use introspection during development and tests, never in production. This can also be set per Schema.

Default: false


Define the names of the schema/operations types. The single _ is a suggestion. In an application that has a Subscription object, it will prevent the conflict. Plus, it is easy to spot that it is something internal. This can also be set per Schema.


  query: '_Query',
  mutation: '_Mutation',
  subscription: '_Subscription',


For performance purposes, this gem implements a JsonCollector. You can disable this option if you prefer to use the standard hash-to-string serialization provided by ActiveSupport. This can also be set per Schema.

Default: true


Set what is de default expected output type of GraphQL requests. String combined with the previous setting has the best performance. On the console, it will automatically shift to Hash. This can also be set per Schema.

Default: :string


Specifies if the results of operations should be encoded with ActiveSupport::JSON#encode instead of the default JSON#generate.

Default: false

Read more


Enable the ability of a callback to inject arguments dynamically into the calling method.

Default: true


Enable the ability of a callback to inject named arguments dynamically into the calling method.

Default: true


When importing fields from modules or other objects, a warning is displayed for any given element that was not able to be correctly imported. You can silence such warnings by changing this option.

Default: false


Enable the ability to define the description of any object, field, or argument using I18n. It is recommended for multi-language documentation.

Default: true


The list of scopes that will be used to locate the descriptions.




A list of execution strategies. Each application can add its own by appending a class, preferably as a string, in this list. This can also be set per Schema.




A list of all possible ruby-to-graphql compatible sources.




A list of all available subscription providers.




The default subscription provider for all schemas. This can also be set per Schema.

Default: 'Rails::GraphQL::Subscription::Provider::ActionCable'


The default value for fields about their ability to be broadcasted. This can also be set per Schema.

Default: nil


A list of known dependencies that can be requested and included in any Schema. This is the best place for other gems to add their own resources and allow users to enable them.


  scalar: {
    any:       "#{__dir__}/type/scalar/any_scalar",
    bigint:    "#{__dir__}/type/scalar/bigint_scalar",
    binary:    "#{__dir__}/type/scalar/binary_scalar",
    date_time: "#{__dir__}/type/scalar/date_time_scalar",
    date:      "#{__dir__}/type/scalar/date_scalar",
    decimal:   "#{__dir__}/type/scalar/decimal_scalar",
    time:      "#{__dir__}/type/scalar/time_scalar",
    json:      "#{__dir__}/type/scalar/json_scalar",
  enum:      {},
  input:     {},
  interface: {},
  object:    {},
  union:     {},
  directive: {},


Important This a temporary.

A future version of the Parser will address this.

The method that should be used to parse literal input values when they are provided as Hash. JSON.parse only supports keys wrapped in quotes. You can use Psych.method(:safe_load) to support keys without quotes, which behaves closer to YAML. The received value is ensured to be wrapped in {}. If that produces unexpected results, you can assign a proc and then parse the value in any other way.

Default: JSON.method(:parse)