Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate input argument into module #4581

Merged

Conversation

tueda0703
Copy link
Contributor

@tueda0703 tueda0703 commented Aug 14, 2023

Summary

There are two functions mixed in RelayClassicMutation, the input relation and the clientMutationId relation.
In our project, we want to use only the input relation, so it should be separated as a single module.
I researched this request and found the following Issue.
#3437
This Issue said "and I'd welcome a PR for either one." so I did it.
The reason it's Closed is because no one else was doing it at the time, not that the change itself is unacceptable, right?

Changes

The input-related functions were split into modules from the two functions of input and clientMutationId.
The behavior has not been changed.

Tested

  • pass unit test
  • work in a local environment with a graphql server

@tueda0703 tueda0703 marked this pull request as ready for review August 14, 2023 06:00
@rmosolgo
Copy link
Owner

Hi, thanks for the suggestion! Does this improve GraphQL-Ruby in some way, or is it a fix for a bug? Could you please help me understand the motivation for this change?

@tueda0703
Copy link
Contributor Author

Hi, thanks for the suggestion! Does this improve GraphQL-Ruby in some way, or is it a fix for a bug? Could you please help me understand the motivation for this change?

This module will be used to improve the functionality.

RelayClassicMutation has two functions: input argument and clientMutationId.

I thought there might be cases where only the input argument functionality would be used, so I divided it into modules.

The user can use

def ExampleMutation < GraphQL::Schema::Mutation
    include GraphQL::Schema::HasSingleInputArgument
...
end

only the input argument functionality is available.

…ate-input-argument-into-module

# Conflicts:
#	lib/graphql/schema/relay_classic_mutation.rb
@tueda0703
Copy link
Contributor Author

The conflict was resolved.

The PR description has been rewritten with more detail.

@@ -31,34 +35,14 @@ class RelayClassicMutation < GraphQL::Schema::Mutation
def resolve_with_support(**inputs)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior has not changed, although a slight modification has been made due to the effect of cutting out input-related processing.

@rmosolgo
Copy link
Owner

Hi! Thanks for updating this and sorry I didn't write back sooner.

I'm open to accepting this change except I'd rather keep the Jazz::... tests and relay_classic_mutation_spec.rb the same. (I'd rather keep them the same so I can keep the high-level tests on RelayClassicMutation, which is widely used -- I don't want to break it!) Instead, how about making a new Schema class in your new test file, and running tests against that new schema?

Here's an example test file with a small schema in it: https://github.com/rmosolgo/graphql-ruby/blob/f6da30f70007be9600783eb1ca054dc771533c8d/spec/graphql/schema/directive/transform_spec.rb#L3C1-L19C6

Do you mind updating this test that way? Then I think we'll be good to merge.

@tueda0703
Copy link
Contributor Author

Thanks for the review.

Fixed test.
Please re-review.

@rmosolgo rmosolgo added this to the 2.1.1 milestone Oct 2, 2023
@rmosolgo
Copy link
Owner

rmosolgo commented Oct 2, 2023

Thanks for this improvement!

@rmosolgo rmosolgo merged commit 3440a65 into rmosolgo:master Oct 2, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants