Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
2f07fef1
Commit
2f07fef1
authored
3 years ago
by
Brett Walker
Browse files
Options
Downloads
Patches
Plain Diff
Fix arg handlling in GraphQL::Helpers
parent
910d7b74
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/support/helpers/graphql_helpers.rb
+24
-8
24 additions, 8 deletions
spec/support/helpers/graphql_helpers.rb
with
24 additions
and
8 deletions
spec/support/helpers/graphql_helpers.rb
+
24
−
8
View file @
2f07fef1
...
...
@@ -107,7 +107,6 @@ def resolve_field(
parent
=
object_type
.
authorized_new
(
object
,
query_ctx
)
raise
UnauthorizedObject
unless
parent
# TODO: This will need to change when we move to the interpreter:
# At that point, arguments will be a plain ruby hash rather than
# an Arguments object
# see: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27536
...
...
@@ -118,20 +117,37 @@ def resolve_field(
defaults_used:
[]
)
# arguments = arguments.to_h.symbolize_keys
arguments
=
arguments
.
to_h
.
transform_keys!
{
|
key
|
key
.
to_s
.
underscore
}.
symbolize_keys
# we enable the request store so we can track gitaly calls.
::
Gitlab
::
WithRequestStore
.
with_request_store
do
# TODO: This will need to change when we move to the interpreter - at that
# point we will call `field#resolve`
# Unwrap the arguments to mutations. This pairs with the wrapping in GraphqlHelpers#resolve
# If arguments are not wrapped first, then arguments processing will raise.
# If arguments are not unwrapped here, then the resolve method of the mutation will raise argument errors.
# arguments = arguments.to_kwargs[:input] if field.resolver && field.resolver <= ::Mutations::BaseMutation
# field.resolve_field(parent, arguments, query_ctx)
# binding.pry
# TODO: re-look at this and comments above
arguments
=
arguments
.
to_kwargs
if
field
.
resolver
&&
field
.
resolver
<=
::
Mutations
::
BaseMutation
field
.
resolve
(
parent
,
arguments
,
query_ctx
)
# arguments = arguments.to_kwargs if field.resolver && field.resolver <= ::Mutations::BaseMutation
if
field
.
resolver
&&
field
.
resolver
<=
::
Mutations
::
BaseMutation
args
[
:input
]
=
GraphQL
::
Schema
::
InputObject
.
new
(
ruby_kwargs:
arguments
[
:input
],
context:
query_ctx
,
defaults_used:
nil
)
else
args
=
arguments
end
field
.
resolve
(
parent
,
args
,
query_ctx
)
#------------------------------------------------------------------------------
# arguments = field.to_graphql.arguments_class.new(
# GraphqlHelpers.deep_fieldnamerize(args),
# context: query_ctx,
# defaults_used: []
# )
# arguments[:input] = GraphQL::Schema::InputObject.new(ruby_kwargs: arguments[:input].to_h, context: query_ctx, defaults_used: nil) if field.resolver && field.resolver <= ::Mutations::BaseMutation
# field.resolve(parent, arguments.to_h, query_ctx)
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment