You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/graphql/schema/argument.rb
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,14 @@ def from_resolver?
39
39
# @param arg_name [Symbol]
40
40
# @param type_expr
41
41
# @param desc [String]
42
+
# @param type [Class, Array<Class>] Input type; positional argument also accepted
43
+
# @param name [Symbol] positional argument also accepted # @param loads [Class, Array<Class>] A GraphQL type to load for the given ID when one is present
44
+
# @param definition_block [Proc] Called with the newly-created {Argument}
45
+
# @param owner [Class] Private, used by GraphQL-Ruby during schema definition
42
46
# @param required [Boolean, :nullable] if true, this argument is non-null; if false, this argument is nullable. If `:nullable`, then the argument must be provided, though it may be `null`.
43
47
# @param description [String]
44
48
# @param default_value [Object]
49
+
# @param loads [Class, Array<Class>] A GraphQL type to load for the given ID when one is present
45
50
# @param as [Symbol] Override the keyword name when passed to a method
46
51
# @param prepare [Symbol] A method to call to transform this argument's valuebefore sending it to field resolution
47
52
# @param camelize [Boolean] if true, the name will be camelized when building the schema
@@ -50,6 +55,8 @@ def from_resolver?
50
55
# @param deprecation_reason [String]
51
56
# @param validates [Hash, nil] Options for building validators, if any should be applied
52
57
# @param replace_null_with_default [Boolean] if `true`, incoming values of `null` will be replaced with the configured `default_value`
58
+
# @param comment [String] Private, used by GraphQL-Ruby when parsing GraphQL schema files
59
+
# @param ast_node [GraphQL::Language::Nodes::InputValueDefinition] Private, used by GraphQL-Ruby when parsing schema files
Copy file name to clipboardExpand all lines: lib/graphql/schema/field.rb
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -209,6 +209,11 @@ def method_conflict_warning?
209
209
# @param method_conflict_warning [Boolean] If false, skip the warning if this field's method conflicts with a built-in method
210
210
# @param validates [Array<Hash>] Configurations for validating this field
211
211
# @param fallback_value [Object] A fallback value if the method is not defined
212
+
# @param dynamic_introspection [Boolean] (Private, used by GraphQL-Ruby)
213
+
# @param relay_node_field [Boolean] (Private, used by GraphQL-Ruby)
214
+
# @param relay_nodes_field [Boolean] (Private, used by GraphQL-Ruby)
215
+
# @param extras [Array<:ast_node, :parent, :lookahead, :owner, :execution_errors, :graphql_name, :argument_details, Symbol>] Extra arguments to be injected into the resolver for this field
216
+
# @param definition_block [Proc] an additional block for configuring the field. Receive the field as a block param, or, if no block params are defined, then the block is `instance_eval`'d on the new {Field}.
Copy file name to clipboardExpand all lines: lib/graphql/schema/member/has_arguments.rb
+37-14Lines changed: 37 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -14,29 +14,52 @@ def self.extended(cls)
14
14
cls.extend(ClassConfigured)
15
15
end
16
16
17
-
# @see {GraphQL::Schema::Argument#initialize} for parameters
18
-
# @return [GraphQL::Schema::Argument] An instance of {argument_class}, created from `*args`
19
-
defargument(*args, **kwargs, &block)
20
-
kwargs[:owner]=self
21
-
loads=kwargs[:loads]
22
-
ifloads
23
-
name=args[0]
24
-
name_as_string=name.to_s
25
-
26
-
inferred_arg_name=casename_as_string
17
+
# @param arg_name [Symbol] The underscore-cased name of this argument, `name:` keyword also accepted
18
+
# @param type_expr The GraphQL type of this argument; `type:` keyword also accepted
19
+
# @param desc [String] Argument description, `description:` keyword also accepted
20
+
# @option kwargs [Boolean, :nullable] :required if true, this argument is non-null; if false, this argument is nullable. If `:nullable`, then the argument must be provided, though it may be `null`.
21
+
# @option kwargs [String] :description Positional argument also accepted
Copy file name to clipboardExpand all lines: lib/graphql/schema/member/has_fields.rb
+47-7Lines changed: 47 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,52 @@ class Schema
5
5
classMember
6
6
# Shared code for Objects, Interfaces, Mutations, Subscriptions
7
7
moduleHasFields
8
+
includeEmptyObjects
8
9
# Add a field to this object or interface with the given definition
9
-
# @param name_positional [Symbol] Keyword `name:` also supported
10
-
# @param type_positional [Class, Array<Class>] Keyword `type:` also supported
11
-
# @param desc_positional [String] Keyword `description:` also supported
12
-
# @see {GraphQL::Schema::Field#initialize} for keywords
10
+
# @param name_positional [Symbol] The underscore-cased version of this field name (will be camelized for the GraphQL API); `name:` keyword is also accepted
11
+
# @param type_positional [Class, GraphQL::BaseType, Array] The return type of this field; `type:` keyword is also accepted
12
+
# @param desc_positional [String] Field description; `description:` keyword is also accepted
13
+
# @option kwargs [Symbol] :name The underscore-cased version of this field name (will be camelized for the GraphQL API); positional argument also accepted
14
+
# @option kwargs [Class, GraphQL::BaseType, Array] :type The return type of this field; positional argument is also accepted
15
+
# @option kwargs [Boolean] :null (defaults to `true`) `true` if this field may return `null`, `false` if it is never `null`
16
+
# @option kwargs [String] :description Field description; positional argument also accepted
17
+
# @option kwargs [String] :comment Field comment
18
+
# @option kwargs [String] :deprecation_reason If present, the field is marked "deprecated" with this message
19
+
# @option kwargs [Symbol] :method The method to call on the underlying object to resolve this field (defaults to `name`)
20
+
# @option kwargs [String, Symbol] :hash_key The hash key to lookup on the underlying object (if its a Hash) to resolve this field (defaults to `name` or `name.to_s`)
21
+
# @option kwargs [Array<String, Symbol>] :dig The nested hash keys to lookup on the underlying hash to resolve this field using dig
22
+
# @option kwargs [Symbol] :resolver_method The method on the type to call to resolve this field (defaults to `name`)
23
+
# @option kwargs [Boolean] :connection `true` if this field should get automagic connection behavior; default is to infer by `*Connection` in the return type name
24
+
# @option kwargs [Class] :connection_extension The extension to add, to implement connections. If `nil`, no extension is added.
25
+
# @option kwargs [Integer, nil] :max_page_size For connections, the maximum number of items to return from this field, or `nil` to allow unlimited results.
26
+
# @option kwargs [Integer, nil] :default_page_size For connections, the default number of items to return from this field, or `nil` to return unlimited results.
27
+
# @option kwargs [Boolean] :introspection If true, this field will be marked as `#introspection?` and the name may begin with `__`
28
+
# @option kwargs [{String=>GraphQL::Schema::Argument, Hash}] :arguments Arguments for this field (may be added in the block, also)
29
+
# @option kwargs [Boolean] :camelize If true, the field name will be camelized when building the schema
30
+
# @option kwargs [Numeric] :complexity When provided, set the complexity for this field
31
+
# @option kwargs [Boolean] :scope If true, the return type's `.scope_items` method will be called on the return value
32
+
# @option kwargs [Symbol, String] :subscription_scope A key in `context` which will be used to scope subscription payloads
33
+
# @option kwargs [Array<Class, Hash<Class => Object>>] :extensions Named extensions to apply to this field (see also {#extension})
34
+
# @option kwargs [Hash{Class => Hash}] :directives Directives to apply to this field
35
+
# @option kwargs [Boolean] :trace If true, a {GraphQL::Tracing} tracer will measure this scalar field
36
+
# @option kwargs [Boolean] :broadcastable Whether or not this field can be distributed in subscription broadcasts
37
+
# @option kwargs [Language::Nodes::FieldDefinition, nil] :ast_node If this schema was parsed from definition, this AST node defined the field
38
+
# @option kwargs [Boolean] :method_conflict_warning If false, skip the warning if this field's method conflicts with a built-in method
39
+
# @option kwargs [Array<Hash>] :validates Configurations for validating this field
40
+
# @option kwargs [Object] :fallback_value A fallback value if the method is not defined
# @option kwargs [Boolean] :dynamic_introspection (Private, used by GraphQL-Ruby)
45
+
# @option kwargs [Boolean] :relay_node_field (Private, used by GraphQL-Ruby)
46
+
# @option kwargs [Boolean] :relay_nodes_field (Private, used by GraphQL-Ruby)
47
+
# @option kwargs [Array<:ast_node, :parent, :lookahead, :owner, :execution_errors, :graphql_name, :argument_details, Symbol>] :extras Extra arguments to be injected into the resolver for this field
48
+
# @param kwargs [Hash] Keywords for defining the field. Any not documented here will be passed to your base field class where they must be handled.
49
+
# @param definition_block [Proc] an additional block for configuring the field. Receive the field as a block param, or, if no block params are defined, then the block is `instance_eval`'d on the new {Field}.
50
+
# @yieldparam field [GraphQL::Schema::Field] The newly-created field instance
# @return [String] A warning to give when this field definition might conflict with a built-in method
269
309
defconflict_field_name_warning(field_defn)
270
310
"#{self.graphql_name}'s `field :#{field_defn.original_name}` conflicts with a built-in method, use `resolver_method:` to pick a different resolver method for this field (for example, `resolver_method: :resolve_#{field_defn.resolver_method}` and `def resolve_#{field_defn.resolver_method}`). Or use `method_conflict_warning: false` to suppress this warning."
0 commit comments