Skip to content

Feature request: generating types from a graphql.schema file for use with graphql-client #1232

@snoble

Description

@snoble

It would be really nice to be able to have types for inputs and results for graphql-client and it feels like it just requires gluing together some existing pieces of code.

A file of graphql queries can be parsed into a Document with GraphQL.parse.
https://github.com/rmosolgo/graphql-ruby/blob/a08c86f097395e27272fdead5037d7b3ef03401e/lib/graphql.rb#L45

And then the tapioca graphq_type_helper can be used to map the graphql types to sorbet types.
https://github.com/Shopify/tapioca/blob/main/lib/tapioca/dsl/helpers/graphql_type_helper.rb

And then you'd want to produce an rbi file that will provide types for the queries produced by GraphQL::Client#parse to be used with GraphQL::Client#query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions