Skip to content

Commit 2f209af

Browse files
committed
fix fragment
1 parent 9018b33 commit 2f209af

File tree

3 files changed

+45
-37
lines changed

3 files changed

+45
-37
lines changed

clientgen/source_generator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (r *SourceGenerator) NewResponseField(selection ast.Selection) *ResponseFie
124124
// この構造体はテンプレート側で使われることはなく、ast.FieldでFragment判定するために使用する
125125
fieldsResponseFields := r.NewResponseFields(selection.Definition.SelectionSet)
126126
typ := types.NewNamed(
127-
types.NewTypeName(0, types.NewPackage(r.client.Filename, r.client.Package), templates.ToGo(selection.Name), nil),
127+
types.NewTypeName(0, r.client.Pkg(), templates.ToGo(selection.Name), nil),
128128
fieldsResponseFields.StructType(),
129129
nil,
130130
)

example/annict/gen/client.go

+35-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/annict/query/query.graphql

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
fragment Viewer on User {
2+
avatarUrl
3+
recordsCount
4+
wannaWatchCount
5+
watchingCount
6+
watchedCount
7+
}
8+
19
query GetProfile {
210
viewer {
3-
avatarUrl
4-
recordsCount
5-
wannaWatchCount
6-
watchingCount
7-
watchedCount
11+
...Viewer
812
}
913
}
1014

0 commit comments

Comments
 (0)