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

graphql_schema outputs graphQL SDL file with legacy syntax #1505

Open
matt-dalton opened this issue Mar 6, 2024 · 0 comments
Open

graphql_schema outputs graphQL SDL file with legacy syntax #1505

matt-dalton opened this issue Mar 6, 2024 · 0 comments
Labels

Comments

@matt-dalton
Copy link

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 to generate types using this schema, it kept throwing an obscure error ([INFO] [default] compiling... [ERROR] ✖︎ Expected a end of file <generated>: <missing source> 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. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant