gql
gql copied to clipboard
Directive @extends status
Hello!
Thank you for this superb API.
My backend is generating a schema that contains this directive declaration:
directive @extends on OBJECT | INTERFACE
I need to remove it or else it break Flutter code generation.
line 1, column 266 of .: 'extends' can't be used as an identifier because it's a keyword.
Thanks!
I came across this too, most likely it should be discussed in the gql repository
Yes, please open an issue in the gql repo, as this is the place where the parsing of the schema is implemented.
Edit: forgot that "transfer issue" exists, so I did it myself ;)
could you try out the gql_code_builder status of #335 (by using dependency_overrides) to check if this solves this issue?
gql_code_builder:
git:
path: codegen/gql_code_builder
url: https://github.com/gql-dart/gql.git
ref: bugfix/espace-references
If not, I would be grateful for a minimal graphql schema that triggers this bug
I tried to check this out, but I got an error in the build:
[INFO] Precompiling build script......
[WARNING] ../../../../.pub-cache/git/gql-0bf7ba76c3a2f381b5db13322efd8c7efd6856fd/codegen/gql_code_builder/lib/src/ast.dart:321:36: Error: The getter 'interfaces' isn't defined for the class 'InterfaceTypeDefinitionNode'.
- 'InterfaceTypeDefinitionNode' is from 'package:gql/src/ast/ast.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/gql-0.13.0/lib/src/ast/ast.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'interfaces'.
"interfaces": _list(node.interfaces),
^^^^^^^^^^
../../../../.pub-cache/git/gql-0bf7ba76c3a2f381b5db13322efd8c7efd6856fd/codegen/gql_code_builder/lib/src/ast.dart:335:36: Error: The getter 'interfaces' isn't defined for the class 'InterfaceTypeExtensionNode'.
- 'InterfaceTypeExtensionNode' is from 'package:gql/src/ast/ast.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/gql-0.13.0/lib/src/ast/ast.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'interfaces'.
"interfaces": _list(node.interfaces),
^^^^^^^^^^
../../../../.pub-cache/git/gql-0bf7ba76c3a2f381b5db13322efd8c7efd6856fd/codegen/gql_code_builder/lib/src/ast.dart:636:28: Error: Member not found: 'variableDefinition'.
case DirectiveLocation.variableDefinition:
^^^^^^^^^^^^^^^^^^
[INFO] Precompiling build script... completed, took 1.4s
Here is an example schema.graphql:
directive @extends on OBJECT | INTERFACE
directive @external on FIELD_DEFINITION
scalar Scalar
enum Enum {
ON
OFF
}
input Input {
id: ID
bool: Boolean
int: Int
float: Float
string: String
scalar: Scalar
enum: Enum
input: Input
idRequired: ID!
boolRequired: Boolean!
intRequired: Int!
floatRequired: Float!
stringRequired: String!
scalarRequired: Scalar!
enumRequired: Enum!
inputRequired: Input!
}
type Field {
id: ID
bool: Boolean
int: Int
float: Float
string: String
scalar: Scalar
enum: Enum
field: Field
idRequired: ID!
boolRequired: Boolean!
intRequired: Int!
floatRequired: Float!
stringRequired: String!
scalarRequired: Scalar!
enumRequired: Enum!
fieldRequired: Field!
}
interface Shape {
area: Float
}
type Square implements Shape {
area: Float
sideLength: Float
}
type Rectangle implements Shape {
area: Float
sideLengthA: Float
sideLengthB: Float
}
type Query {
field(
id: ID
bool: Boolean
int: Int
float: Float
string: String
scalar: Scalar
enum: Enum
input: Input
idRequired: ID!
boolRequired: Boolean!
intRequired: Int!
floatRequired: Float!
stringRequired: String!
scalarRequired: Scalar!
enumRequired: Enum!
inputRequired: Input!
): Field
shape: Shape
}