Module: GraphQL::Stitching::TypeResolver::ArgumentsParser Private
- Included in:
- GraphQL::Stitching::TypeResolver
- Defined in:
- lib/graphql/stitching/type_resolver/arguments.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Parser for building argument templates into resolver structures
Instance Method Summary collapse
-
#parse_arguments_with_field(template, field_def) ⇒ [GraphQL::Stitching::TypeResolver::Argument]
private
Parses an argument template string into resolver arguments via schema casting.
-
#parse_arguments_with_type_defs(template, type_defs) ⇒ [GraphQL::Stitching::TypeResolver::Argument]
private
Parses an argument template string into resolver arguments via SDL casting.
Instance Method Details
#parse_arguments_with_field(template, field_def) ⇒ [GraphQL::Stitching::TypeResolver::Argument]
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses an argument template string into resolver arguments via schema casting.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 178 def parse_arguments_with_field(template, field_def) ast = parse_arg_defs(template) args = build_argument_set(ast, field_def.arguments) args.each do |arg| next unless arg.key? if field_def.type.list? && !arg.list? raise CompositionError, "Cannot use repeatable key for `#{field_def.owner.graphql_name}.#{field_def.graphql_name}` " \ "in non-list argument `#{arg.name}`." elsif !field_def.type.list? && arg.list? raise CompositionError, "Cannot use non-repeatable key for `#{field_def.owner.graphql_name}.#{field_def.graphql_name}` " \ "in list argument `#{arg.name}`." end end args end |
#parse_arguments_with_type_defs(template, type_defs) ⇒ [GraphQL::Stitching::TypeResolver::Argument]
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses an argument template string into resolver arguments via SDL casting.
200 201 202 203 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 200 def parse_arguments_with_type_defs(template, type_defs) type_map = parse_type_defs(type_defs) parse_arg_defs(template).map { build_argument(_1, type_struct: type_map[_1.name]) } end |