Conversation
|
Hey, thanks for bringing this over from graphql-client! I'm definitely game to merge this and release it. But, could you add some tests for it to be sure that we don't accidentally break it in the future? For example, I could imagine a test that creates a new schema (perhaps based on a SDL definition?) and generates the the RBI file for it, then compares the generated file to our expected content. (That's what came to mind for me but I'm open to any kind of testing.) What do you think of adding something like that? |
|
What's the status of this @iMacTia? We're looking to add graphql-client into our application, but not having static types is kind of a deal-breaker for us |
|
Sorry for the late reply @themagickoala, unfortunately I didn't have any time to add tests to this, I'm really sorry! |
Summary
Adds a tapioca compiler to automatically generate RBIs for dynamically generated GraphQL type classes.
How it works
The compiler is opt-in, as it relies on a
Typesconstant being defined with all theGraphQL::Client.types.To make it pick up and generate RBIs for your client, you just need to set this constant in your API module:
Once that is added and
tapioca dslis run, RBIs forSWAPI::Types::<name>will be generated, allowing you to use them in Sorbet signatures. Obviously, theTypesconstant can be called anything you'd like, as far as its value it set toClient.types.