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

introspection: create a graphql schema from introspection query with GraphQLClientSchema::new #171

Closed
lrlna opened this issue Jan 13, 2021 · 0 comments · Fixed by #283
Closed
Assignees
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Milestone

Comments

@lrlna
Copy link
Member

lrlna commented Jan 13, 2021

Description

Given a result from an Introspection Query, we should be able to construct a GraphQLClientSchema.

Detailed design

GraphQLClientSchema::new should be an implementation of what buildClientSchema does in graphql-js. That is, given an introspection result:

  1. Traverse all available types in result's __schema and get their type definitions

  2. Include only Scalar and Introspection types that are present in the query result

  3. Include root Query, Mutation, and Subscription types

  4. Include introspection supported Directives

  5. Construct a Schema object with the following definitions:

    pub struct GraphQLClientSchema {
        description: String,
        query: QueryType,
        mutation: MutationType,
        subscription: SubscriptionType,
        types: SchemaTypes,
        directives: Directives,
    }

Test plan

To ensure our generated SDL is inline with javascript's reference implementation, we need to implement all of the test cases in listed in graphql-js/buildClientSchema.

References

This issue is part of introspection work discussed in this internal scope document.

@lrlna lrlna added the feature 🎉 new commands, flags, functionality, and improved error messages label Jan 14, 2021
@lrlna lrlna added this to the 🐣 0.1.0 milestone Jan 14, 2021
@lrlna lrlna self-assigned this Jan 15, 2021
@lrlna lrlna modified the milestones: 0.0.2, 0.0.4 Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants