Module: GraphQL::DeprecatedDSL

Defined in:
lib/graphql/deprecated_dsl.rb

Overview

There are two ways to apply the deprecated ! DSL to class-style schema definitions:

  1. Scoped by file (CRuby only), add to the top of the file:

    using GraphQL::DeprecationDSL

(This is a “refinement”, there are also other ways to scope it.)

  1. Global application, add before schema definition:

    GraphQL::DeprecationDSL.activate

Defined Under Namespace

Modules: Methods

Constant Summary collapse

TYPE_CLASSES =
[
  GraphQL::Schema::Scalar,
  GraphQL::Schema::Enum,
  GraphQL::Schema::InputObject,
  GraphQL::Schema::Union,
  GraphQL::Schema::Interface,
  GraphQL::Schema::Object,
]

Class Method Summary collapse

Class Method Details

.activateObject



25
26
27
28
29
30
31
# File 'lib/graphql/deprecated_dsl.rb', line 25

def self.activate
  deprecated_caller = caller(1, 1).first
  GraphQL::Deprecation.warn "DeprecatedDSL will be removed from GraphQL-Ruby 2.0, use `.to_non_null_type` instead of `!` and remove `.activate` from #{deprecated_caller}"
  TYPE_CLASSES.each { |c| c.extend(Methods) }
  GraphQL::Schema::List.include(Methods)
  GraphQL::Schema::NonNull.include(Methods)
end