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/member/has_fields.rb
+56-84Lines changed: 56 additions & 84 deletions
Original file line number
Diff line number
Diff line change
@@ -10,107 +10,79 @@ module HasFields
10
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
11
# @param type_positional [Class, GraphQL::BaseType, Array] The return type of this field; `type:` keyword is also accepted
12
12
# @param desc_positional [String] Field description; `description:` keyword is also accepted
13
-
# @param name [Symbol] The underscore-cased version of this field name (will be camelized for the GraphQL API); positional argument also accepted
14
-
# @param type [Class, GraphQL::BaseType, Array] The return type of this field; positional argument is also accepted
15
-
# @param null [Boolean] (defaults to `true`) `true` if this field may return `null`, `false` if it is never `null`
16
-
# @param description [String] Field description; positional argument also accepted
17
-
# @param comment [String] Field comment
18
-
# @param deprecation_reason [String] If present, the field is marked "deprecated" with this message
19
-
# @param method [Symbol] The method to call on the underlying object to resolve this field (defaults to `name`)
20
-
# @param hash_key [String, Symbol] 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
-
# @param dig [Array<String, Symbol>] The nested hash keys to lookup on the underlying hash to resolve this field using dig
22
-
# @param resolver_method [Symbol] The method on the type to call to resolve this field (defaults to `name`)
23
-
# @param connection [Boolean] `true` if this field should get automagic connection behavior; default is to infer by `*Connection` in the return type name
24
-
# @param connection_extension [Class] The extension to add, to implement connections. If `nil`, no extension is added.
25
-
# @param max_page_size [Integer, nil] For connections, the maximum number of items to return from this field, or `nil` to allow unlimited results.
26
-
# @param default_page_size [Integer, nil] For connections, the default number of items to return from this field, or `nil` to return unlimited results.
27
-
# @param introspection [Boolean] If true, this field will be marked as `#introspection?` and the name may begin with `__`
28
-
# @param arguments [{String=>GraphQL::Schema::Argument, Hash}] Arguments for this field (may be added in the block, also)
29
-
# @param camelize [Boolean] If true, the field name will be camelized when building the schema
30
-
# @param complexity [Numeric] When provided, set the complexity for this field
31
-
# @param scope [Boolean] If true, the return type's `.scope_items` method will be called on the return value
32
-
# @param subscription_scope [Symbol, String] A key in `context` which will be used to scope subscription payloads
33
-
# @param extensions [Array<Class, Hash<Class => Object>>] Named extensions to apply to this field (see also {#extension})
34
-
# @param directives [Hash{Class => Hash}] Directives to apply to this field
35
-
# @param trace [Boolean] If true, a {GraphQL::Tracing} tracer will measure this scalar field
36
-
# @param broadcastable [Boolean] Whether or not this field can be distributed in subscription broadcasts
37
-
# @param ast_node [Language::Nodes::FieldDefinition, nil] If this schema was parsed from definition, this AST node defined the field
38
-
# @param method_conflict_warning [Boolean] If false, skip the warning if this field's method conflicts with a built-in method
39
-
# @param validates [Array<Hash>] Configurations for validating this field
40
-
# @param fallback_value [Object] A fallback value if the method is not defined
# @param dynamic_introspection [Boolean] (Private, used by GraphQL-Ruby)
45
-
# @param relay_node_field [Boolean] (Private, used by GraphQL-Ruby)
46
-
# @param relay_nodes_field [Boolean] (Private, used by GraphQL-Ruby)
47
-
# @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
48
-
# @param custom_kwargs [Hash] Application-specific keywords; must be handled by your base {Field} class
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
+
49
+
# @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
50
# @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
51
# @yieldparam field [GraphQL::Schema::Field] The newly-created field instance
raiseArgumentError,"Provide description as a positional argument or `description:` keyword, but not both (#{desc_positional.inspect}, #{description.inspect})"
66
+
ifkwargs[:description]
67
+
raiseArgumentError,"Provide description as a positional argument or `description:` keyword, but not both (#{desc_positional.inspect}, #{kwargs[:description].inspect})"
# @return [String] A warning to give when this field definition might conflict with a built-in method
338
310
defconflict_field_name_warning(field_defn)
339
311
"#{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