Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #83 from comigor/mutation-root
Browse files Browse the repository at this point in the history
Fix: Look at mutation root when generating a mutation
  • Loading branch information
comigor authored Feb 19, 2020
2 parents fb4ebfb + 9ff9b9d commit 005e6a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 4.0.1
- Look at mutation root when generating a mutation

## 4.0.0
**MAJOR BREAKING CHANGE**
This version completely refactors how Artemis generate code (by finally
Expand Down
8 changes: 5 additions & 3 deletions lib/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ QueryDefinition generateQuery(
final basename = p.basenameWithoutExtension(path);
final queryName = operation.name?.value ?? basename;
final className = ReCase(queryName).pascalCase;
final queryType = operation.type == OperationType.query
? schema.queryType.name
: schema.mutationType.name;

final parentType = gql.getTypeByName(
schema, (schema.queryType ?? schema.mutationType)?.name,
context: 'query/mutation root');
final parentType =
gql.getTypeByName(schema, queryType, context: 'query/mutation root');

final suffix = operation.type == OperationType.query ? 'Query' : 'Mutation';

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: artemis
version: 4.0.0
version: 4.0.1

authors:
- Igor Borges <[email protected]>
Expand Down

0 comments on commit 005e6a5

Please sign in to comment.