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

Make sure we can type GraphQL object with anonymous input fields #1162

Merged
merged 3 commits into from
Sep 13, 2022

Conversation

rafaelfranca
Copy link
Member

@rafaelfranca rafaelfranca commented Sep 13, 2022

Motivation

When the class is anonymous, qualified_name_of returns nil. This
means that type_for would raise an exception, causing the rbi generator
to fail.

Implementation

Return T.untyped for the anonymous case

Other info

Those commits are already applied to master (I used VSCode to sync the code and it end up pushing the changes), so this is only for the 0-10-stable branch.

When the class is anonymous, `qualified_name_of` returns `nil`. This
means that `type_for` would raise an exception, causing the rbi generator
to fail.

Instead, we should be just returning `T.untyped` for that case.
There is no need for the instance, so just make it a module.
@rafaelfranca rafaelfranca requested a review from a team as a code owner September 13, 2022 20:59
Copy link
Contributor

@KaanOzkan KaanOzkan left a comment

Choose a reason for hiding this comment

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

First commit is functionally equivalent to this PR #1146. I don't have strong opinions between the type_for_constant helper method and checking if parsed_type is nil at the end of the switch.

@rafaelfranca
Copy link
Member Author

That PR wan't handling the case when the one of values of the enum was anonymous. Not that I think it should happen, but better to be safe.

This will also fix Ruby 2.7 problem that doesn't work
with include in singleton classes.
@rafaelfranca rafaelfranca merged commit f51651f into 0-10-stable Sep 13, 2022
@rafaelfranca rafaelfranca deleted the fix-graphql branch September 13, 2022 21:49
@shopify-shipit shopify-shipit bot temporarily deployed to 0-10-stable September 14, 2022 02:35 Inactive
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.

3 participants