-
Notifications
You must be signed in to change notification settings - Fork 112
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
Restore type_for(type)
function
#1714
Conversation
T.class_of(GraphQL::Schema::Scalar), | ||
T.class_of(GraphQL::Schema::Enum), | ||
T.class_of(GraphQL::Schema::Union), | ||
T.class_of(GraphQL::Schema::Object), | ||
T.class_of(GraphQL::Schema::Interface), | ||
T.class_of(GraphQL::Schema::InputObject), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have put
- a simple
T.class_of(GraphQL::Schema::Member)
- a T.untyped
But, the first option is referring to a "private API" which I'm not really fond of, and the second option seems to be missing the point...
e068e6f
to
03a201c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation looks good and thank you for the tests.
I'm not 100% sure if we should support this but I'm leaning towards yes. I'll wait for another reviewer to confirm it's okay before merging.
Flagging as draft as there were other refactorings which made this PR actually outdated. Will rework. |
03a201c
to
2c556ed
Compare
@KaanOzkan rebased at head to take into account latest modifications. Not too impacting it seems. @vinistock do you think you could have a look at this PR eventually ? (Or is there someone else I would need to contact to that extent ?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me. There are some CI failures though
… to sorbet it should only be a symbol but according to the doc it passes)
I believe I fixed the linting (or more specifically, the type check error). I'm not too sure about how to reproduce the errors reported for the other ruby versions though. Still checking. |
Failures were unrelated to this PR |
Motivation
Following #1622 the function
Tapioca::Dsl::Helpers::GraphqlTypeHelper#type_for
required anGraphQL::Schema::Argument
(instead of aGraphQL::Schema::Wrapper
) to be passed.Though this did make perfectly sense, we actually used that method to explicitly compute types in our DSL process without this being necessarily "for a field". For example it could be for union types.
Implementation
What I did was:
type_for
method to be backward compatible with the pre Update GraphQL mutation compiler to consider arguments withreplace_null_with_default
#1622 code (e.g. keep accepting a soleGraphQL::Schema::Wrapper
argument as a parameter)type_for_argument
which would be redirecting appropriately to keep Update GraphQL mutation compiler to consider arguments withreplace_null_with_default
#1622 featureTests
I added tests for some introduced adherence.