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
Cannot define multiple queries (with fragments) in a single .graphql file #307
Comments
having the same issue |
I tried to reporduce your issue but I do not have any issues. Here is generated code @override
final DocumentNode document = DocumentNode(definitions: [
FragmentDefinitionNode(
name: NameNode(value: 'pokemonFragment'),
typeCondition: TypeConditionNode(
on: NamedTypeNode(
name: NameNode(value: 'Pokemon'), isNonNull: false)),
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'number'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
OperationDefinitionNode(
type: OperationType.query,
name: NameNode(value: 'getPokemon'),
variableDefinitions: [
VariableDefinitionNode(
variable: VariableNode(name: NameNode(value: 'name')),
type: NamedTypeNode(
name: NameNode(value: 'String'), isNonNull: true),
defaultValue: DefaultValueNode(value: null),
directives: [])
],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'pokemon'),
alias: null,
arguments: [
ArgumentNode(
name: NameNode(value: 'name'),
value: VariableNode(name: NameNode(value: 'name')))
],
directives: [],
selectionSet: SelectionSetNode(selections: [
FragmentSpreadNode(
name: NameNode(value: 'pokemonFragment'), directives: [])
]))
]))
]); |
@fpabl0 as you see - there is only one |
Maybe this issue is already solved in beta branch? As I said above, I can't test it in the beta branch because it causes me conflicting dependencies problems, but I can try a clean project to test this issue if that is the case. |
The beta branch is null safety only. |
I see, your tests were done in the beta branch right? |
haha. |
Fixed in 7.0.0-beta.11 |
Great! Thanks :)
Unfortunately no 😞, some of my dependencies are not nullsafety yet. |
Is there a way in which we can generate all the fragments in one file and rest of the stuff in different files? |
@ramyak-mehra not for now |
@fpabl0 what are they? |
@ramyak-mehra to give you more context I would add that there are some requests from time to time about separation of output but they are quite different. So the next day we implement some of them there will be a new request... |
Yeah I mean it makes sense for the most part, it was just another way I was looking at things. |
Basically my app needs bluetooth, so I am using this one: https://github.com/Polidea/FlutterBleLib. The problem is that Polidea was acquired by other company and they are trying to get new maintainers currently. It has a null-safety branch but I am worried if that is stable as the non-null-safety one is. There are other libraries for bluetooth, but I had many runtime errors with them, so I kept Polidea library. Anyway, I will give it a chance. Thank you very much for your help. This is an amazing library :) |
It’s a good time to try. In one day there will be no option besides the null safety :-) |
Yes, you are right. I'll try 😄. You can close already this issue if that is ok for you :) as it is already solved. |
Before reporting a bug, please test the beta branch!
(Unfortunately I can't test it with the beta branch because it caused a lot of conflicting dependencies problems in my application).
Bug description
When multiple queries are defining in the same file using fragments, Artemis generate a Query with the Fragment declared twice. That causes this exception at runtime:
Here it is defined twice:
Specs
Artemis version: 6.18.4
build.yaml:
Artemis output:
The error occurs at runtime.
GraphQL schema:
GraphQL query:
The text was updated successfully, but these errors were encountered: