graphql 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of graphql might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35d89f9a897b7897a59009d2b66b436750540da911e3c8e86e185f317d74b0e8
4
- data.tar.gz: 13c06d0144815bbafcdff091815fa939969e51d693e1e33138358131df509783
3
+ metadata.gz: 823ea48d61ed1b30e6ad87a6817f80206b9c5d8865f6350cbd142c9798162e37
4
+ data.tar.gz: 8e5f383cfe80418109b0f424d06ab7a78c72255d167f21f32b6c8f6bcef10610
5
5
  SHA512:
6
- metadata.gz: '063911bc20713d486f3dca9cec21a881a4558a300b8cf03a19f34a82f23cbcd808f3a9b0b51b886b795c3c42e6b559b954e64b6a2a3f69ddd009145ae09cee4f'
7
- data.tar.gz: cbe4c5cda73c9fcc7bfb6a0e2249ba8c8dbad4e26ad3c2baf7cc5775fac6f7f19ac036baaea25d80b2fbaa58e9cade521a26d7b3c5bdd936b63efc9971c28ce1
6
+ metadata.gz: 95e9de185715e1b2a752ecaefdd75e8b4daad8afd4125429d58627972805d759c3a842a58bec29b0b5ee1aba5e1d06a6cb1aed9bd1881653d710f71fe4edfdc7
7
+ data.tar.gz: 99ff2f59d77ee74ba4c1af7fcf097afb5415b6d18a95c1a2527413d6f782f8fa6238aafa96430d2d7332f1177e64b70e5aa2eac1557d042ede9eb4a33466b8b5
@@ -187,7 +187,7 @@ module GraphQL
187
187
  # @param name [Symbol] The underscore-cased version of this field name (will be camelized for the GraphQL API)
188
188
  # @param type [Class, GraphQL::BaseType, Array] The return type of this field
189
189
  # @param owner [Class] The type that this field belongs to
190
- # @param null [Boolean] `true` if this field may return `null`, `false` if it is never `null`
190
+ # @param null [Boolean] (defaults to `true`) `true` if this field may return `null`, `false` if it is never `null`
191
191
  # @param description [String] Field description
192
192
  # @param deprecation_reason [String] If present, the field is marked "deprecated" with this message
193
193
  # @param method [Symbol] The method to call on the underlying object to resolve this field (defaults to `name`)
@@ -211,7 +211,7 @@ module GraphQL
211
211
  # @param ast_node [Language::Nodes::FieldDefinition, nil] If this schema was parsed from definition, this AST node defined the field
212
212
  # @param method_conflict_warning [Boolean] If false, skip the warning if this field's method conflicts with a built-in method
213
213
  # @param validates [Array<Hash>] Configurations for validating this field
214
- def initialize(type: nil, name: nil, owner: nil, null: true, description: :not_given, deprecation_reason: nil, method: nil, hash_key: nil, dig: nil, resolver_method: nil, connection: nil, max_page_size: :not_given, scope: nil, introspection: false, camelize: true, trace: nil, complexity: nil, ast_node: nil, extras: EMPTY_ARRAY, extensions: EMPTY_ARRAY, connection_extension: self.class.connection_extension, resolver_class: nil, subscription_scope: nil, relay_node_field: false, relay_nodes_field: false, method_conflict_warning: true, broadcastable: nil, arguments: EMPTY_HASH, directives: EMPTY_HASH, validates: EMPTY_ARRAY, &definition_block)
214
+ def initialize(type: nil, name: nil, owner: nil, null: nil, description: :not_given, deprecation_reason: nil, method: nil, hash_key: nil, dig: nil, resolver_method: nil, connection: nil, max_page_size: :not_given, scope: nil, introspection: false, camelize: true, trace: nil, complexity: nil, ast_node: nil, extras: EMPTY_ARRAY, extensions: EMPTY_ARRAY, connection_extension: self.class.connection_extension, resolver_class: nil, subscription_scope: nil, relay_node_field: false, relay_nodes_field: false, method_conflict_warning: true, broadcastable: nil, arguments: EMPTY_HASH, directives: EMPTY_HASH, validates: EMPTY_ARRAY, &definition_block)
215
215
  if name.nil?
216
216
  raise ArgumentError, "missing first `name` argument or keyword `name:`"
217
217
  end
@@ -253,7 +253,13 @@ module GraphQL
253
253
  @resolver_method = resolver_method
254
254
  @complexity = complexity
255
255
  @return_type_expr = type
256
- @return_type_null = null
256
+ @return_type_null = if !null.nil?
257
+ null
258
+ elsif resolver_class
259
+ nil
260
+ else
261
+ true
262
+ end
257
263
  @connection = connection
258
264
  @has_max_page_size = max_page_size != :not_given
259
265
  @max_page_size = max_page_size == :not_given ? nil : max_page_size
@@ -530,17 +536,13 @@ module GraphQL
530
536
  attr_writer :type
531
537
 
532
538
  def type
533
- if @return_type_expr.nil?
534
- if @resolver_class && (t = @resolver_class.type)
535
- t
536
- else
537
- # Not enough info to determine type
538
- message = "Can't determine the return type for #{self.path}"
539
- if @resolver_class
540
- message += " (it has `resolver: #{@resolver_class}`, perhaps that class is missing a `type ...` declaration, or perhaps its type causes a cyclical loading issue)"
541
- end
542
- raise MissingReturnTypeError, message
539
+ if @resolver_class
540
+ return_type = @return_type_expr || @resolver_class.type_expr
541
+ if return_type.nil?
542
+ raise MissingReturnTypeError, "Can't determine the return type for #{self.path} (it has `resolver: #{@resolver_class}`, perhaps that class is missing a `type ...` declaration, or perhaps its type causes a cyclical loading issue)"
543
543
  end
544
+ nullable = @return_type_null.nil? ? @resolver_class.null : @return_type_null
545
+ Member::BuildType.parse_type(return_type, null: nullable)
544
546
  else
545
547
  @type ||= Member::BuildType.parse_type(@return_type_expr, null: @return_type_null)
546
548
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
@@ -596,7 +596,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
596
596
  - !ruby/object:Gem::Version
597
597
  version: '0'
598
598
  requirements: []
599
- rubygems_version: 3.3.3
599
+ rubygems_version: 3.2.32
600
600
  signing_key:
601
601
  specification_version: 4
602
602
  summary: A GraphQL language and runtime for Ruby