Skip to content

Replacing #to_graphql in tests #3977

Answered by rmosolgo
slimdave asked this question in Q&A
Discussion options

You must be logged in to vote

why we do that

Yep, this isn't the first time I've heard of it! (Even the graphql-ruby tests did it.) In short, when a legacy Input Object definition was created, it also created a custom GraphQL::Query::Arguments subclass which contained some behavior pertaining to the input object's specific arguments.

Inside InputObject#initialize, it would do different kinds of initialization given different inputs. Legacy-style inputs would still work if the custom Arguments subclass was also present. So probably, when migrating from .define-based definitions to class-based definitions, adding .to_graphql (which, under the hood, prepared that specialized Arguments subclass) made the previous initia…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@slimdave
Comment options

@rmosolgo
Comment options

@slimdave
Comment options

Answer selected by slimdave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants