question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No way to use the graphql schema language

See original GitHub issue

Am I missing something, or is there no way to take advantage of the handy graphql schema definition language? It would be great to be able to use the schema language in the same way the javascript implementation does (with buildschema, I think).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:8

github_iconTop GitHub Comments

3reactions
tarekrachedcommented, Apr 18, 2018

…and even that’s unnecessary, as the __str__ method of graphene.Schema already does this.

3reactions
samirbrcommented, May 2, 2017

There is a way, but not in Graphene.

import graphql
source = open('/path/to/graphql/schema/file')
ast = graphql.parse(source.read())
source.close()
schema = graphql.build_ast_schema(ast)

def resolve_users(args, context, info):
      // do something
      

resolvers = {
      'users': resolve_users
}

Then, in theory you can use graphql(schema, root_value=resolvers) to execute.

I tested parse the schema file to graphql schema, but not execute with my own resolvers yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Schemas and Types - GraphQL
We'll use the "GraphQL schema language" - it's similar to the query language, and allows us to talk about GraphQL schemas in a...
Read more >
GraphQL schema basics - Apollo GraphQL Docs
The GraphQL specification defines a human-readable schema definition language (or SDL) that you use to define your schema and store it as a...
Read more >
An Introduction to GraphQL: Schema, Resolvers and More
The schema is written using the GraphQL schema language (also called schema definition language, SDL). With it, you can define object types ......
Read more >
How not to learn GraphQL – The Guild
A good GraphQL Schema design should: simplify the usage by providing the proper abstractions (ex: aggregated fields, atomic mutation across ...
Read more >
GraphQL SDL — Schema Definition Language - Prisma
GraphQL has its own language to write GraphQL Schemas: The GraphQL Schema Definition Language (SDL). SDL is simple and intuitive to use ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found