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 #255 from comigor/bugfix/append-typename-growable
Browse files Browse the repository at this point in the history
append type name growable bugfix
  • Loading branch information
vasilich6107 authored Jan 26, 2021
2 parents 892b096 + 9e67838 commit 305bb68
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 6.19.2-beta.1
- bugfix of append typename

## 6.19.1-beta.1
- Append typename flag

Expand Down
17 changes: 13 additions & 4 deletions lib/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,19 @@ Make sure that `queries_glob` your build.yaml file include GraphQL queries files
.toList();

if (schemaMap.appendTypeName) {
gqlDocs = gqlDocs
.map((doc) =>
transform(doc, [AppendTypename(schemaMap.typeNameField)]))
.toList();
gqlDocs = gqlDocs.map(
(doc) {
final transformed =
transform(doc, [AppendTypename(schemaMap.typeNameField)]);

// transform makes definitions growable: false so just recreate it again
// as far as we need to add some elements there lately
return DocumentNode(
definitions: List.from(transformed.definitions),
span: transformed.span,
);
},
).toList();
}

final schemaAssetStream = buildStep.findAssets(Glob(schemaMap.schema));
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: 6.19.1-beta.1
version: 6.19.2-beta.1

description: Build dart types from GraphQL schemas and queries (using Introspection Query).
homepage: https://github.com/comigor/artemis
Expand Down

0 comments on commit 305bb68

Please sign in to comment.