Skip to content

Implement introspection schema.json generation #307

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

Closed
theduke opened this issue Dec 20, 2018 · 5 comments · Fixed by #337
Closed

Implement introspection schema.json generation #307

theduke opened this issue Dec 20, 2018 · 5 comments · Fixed by #337
Assignees
Labels
easy enhancement Improvement of existing features or bugfix

Comments

@theduke
Copy link
Member

theduke commented Dec 20, 2018

Implement a method to easily create a schema.json introspection schema used by tools like apollo cli and https://github.com/graphql-rust/graphql-client.

For simplicity I'd just execute the introspection query against the schema and return the result.

@theduke theduke added enhancement Improvement of existing features or bugfix help wanted easy labels Dec 20, 2018
@theduke
Copy link
Member Author

theduke commented Dec 20, 2018

Example query:

query IntrospectionQuery {

  __schema {

    queryType {

      name

    }

    mutationType {

      name
    

    }

    subscriptionType {

      name

    }

    types {

      ...FullType

    }

    directives {

      name

      description

      locations

      args {

        ...InputValue

      }

    }

  }

}

fragment FullType on __Type {

  kind

  name

  description

  fields(includeDeprecated: true) {

    name

    description

    args {

      ...InputValue

    }

    type {

      ...TypeRef

    }

    isDeprecated

    deprecationReason

  }

  inputFields {

    ...InputValue

  }

  interfaces {

    ...TypeRef

  }

  enumValues(includeDeprecated: true) {

    name

    description

    isDeprecated

    deprecationReason

  }

  possibleTypes {

    ...TypeRef

  }

}

fragment InputValue on __InputValue {

  name

  description

  type {

    ...TypeRef

  }

  defaultValue

}

fragment TypeRef on __Type {

  kind

  name

  ofType {

    kind

    name

    ofType {

      kind

      name

      ofType {

        kind

        name

        ofType {

          kind

          name

          ofType {

            kind

            name

            ofType {

              kind

              name

              ofType {

                kind

                name

              }

            }

          }

        }

      }

    }

  }

}

@mrceperka
Copy link

mrceperka commented Jan 14, 2019

Juniper is able to process this query, but apollo fails to generate schema.json.
I've received this error:

 Expected a value of type "__DirectiveLocation" but received: "INLINE_SPREAD"

I was looking at https://github.com/facebook/graphql/blob/master/spec/Section%204%20--%20Introspection.md and there FRAGMENT_SPREAD. Maybe there is a typo in juniper...

I see that this is fixed (c7d1481). So I will probably have to wait for another realease or use master.

@theduke
Copy link
Member Author

theduke commented Jan 14, 2019

@mrceperka yeah it's currently in master, so you could use a Git dependency for now until we push out a patch release.

@LegNeato LegNeato self-assigned this Mar 1, 2019
@LegNeato
Copy link
Member

LegNeato commented Mar 1, 2019

I have implemented this. Just cleaning up the code and adding tests before putting up a PR.

LegNeato added a commit to LegNeato/juniper that referenced this issue Mar 2, 2019
LegNeato added a commit to LegNeato/juniper that referenced this issue Mar 2, 2019
LegNeato added a commit to LegNeato/juniper that referenced this issue Mar 2, 2019
@LegNeato
Copy link
Member

LegNeato commented Mar 2, 2019

Hmmm, actually my PR may does fix this issue...it doesn't output in JSON. Which is different.

LegNeato added a commit to LegNeato/juniper that referenced this issue Apr 4, 2019
LegNeato added a commit to LegNeato/juniper that referenced this issue Apr 4, 2019
LegNeato added a commit to LegNeato/juniper that referenced this issue Apr 4, 2019
LegNeato added a commit to LegNeato/juniper that referenced this issue Apr 4, 2019
LegNeato added a commit to LegNeato/juniper that referenced this issue Apr 4, 2019
LegNeato added a commit to LegNeato/juniper that referenced this issue Apr 4, 2019
theduke pushed a commit that referenced this issue Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants