graphql-python / graphql-python/graphene-django
graphql_schema outputs graphQL SDL file with legacy syntax
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 760
- PR merge metrics
- No merged PRs in 30d
Description
**What is the current behavior?**
When I run the graphql_schema management function with a graphQL output (e.g. `python manage.py graphql_schema --out schema.graphql`) I get a schema that looks like:
```
type Mutation {
addTodo(name: String!, priority: Priority = LOW): Todo!
removeTodo(id: ID!): Todo!
}
schema {
query: Query
mutation: Mutation
}
type Viewer implements Node, ViewerBaseInterface {
id: ID!
}
interface ViewerBaseInterface {
otherField: String
}
interface Node {
id: ID!
}
```
When I tried to use the [Relay compiler](https://www.npmjs.com/package/relay-compiler?activeTab=explore) to generate types using this schema, it kept throwing an obscure error (`[INFO] [default] compiling... [ERROR] ✖︎ Expected a end of file : ` for anyone struggling with this)
After much debugging, I discovered this line was the problem:
`type Viewer implements Node, ViewerBaseInterface`
The issue is with the comma syntax to denote inheritance from multiple interfaces. This syntax should now look like `type Viewer implements Node & ViewerBaseInterface`.
This issue is described on the Relay side [here](https://github.com/facebook/relay/issues/2364). The fix is to update the schema generation to a later version (in JS this version is `graphql-js` v0.13).
**What is the expected behavior?**
We are unfortunately still on Graphene v2.1.9/Graphene-django 2.16.0. We are planning to upgrade later in the year but this will be a fairly large undertaking for us. Because of this I'm not sure if Graphene v3 fixes the issue.
Either way, would it be possible to release a v2 version with the new syntax generator to allow us/others to work around this issue?
Alternatively is there another way we can work round this in the short-term? e.g. what dependency should we update if we wanted to create a fork?
**What is the motivation / use case for changing the behavior?**
Supporting new graphQL behaviour on v2
**Please tell us about your environment:**
- Version:
graphene = "2.1.9"
graphene-django = "2.16.0"
- Platform: mac
**Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)
Similar issue with a different library: https://stackoverflow.com/questions/49198778/relay-compiler-cannot-compile-graph-cool-graphql-schemas-with-multiple-inheritan
Contributor guide
Assessment
This issue has not been assessed yet.