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

Fix: Look at mutation root when generating a mutation #83

Merged
merged 1 commit into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <igor@borges.dev>
Expand Down