aws-amplify / aws-amplify/amplify-codegen

Do we fully support fragments?

Open
#29 7 comments 2 reactions 0 assignees View on GitHub
feature-request fragments-support
Dominant language
TypeScript
Stars
59
Forks
64
PR merge metrics
No merged PRs in 30d

Description

** Which Category is your question related to? **
GraphQL transformer codegen

** Provide additional details e.g. code snippets **
I'm adding a fragment in a custom GraphQL query file. For example:

```
fragment SheetParts on Sheet {
id,
name,
bpm,
}

query ListItemPage($id: ID!) {
getList(id: $id) {
name,
sheets {
items {
...SheetParts
}
}
}
}

query MyLibraryPage($limit: Int, $nextToken: String) {
listSheets(limit: $limit, nextToken: $nextToken) {
nextToken,
items {
...SheetParts
}
}
}

```
Codegen gracefully generates SheetPartsFragment into my API, but when requesting the qery through the generated API, I get this error:

`core.js:15724 ERROR Error: Uncaught (in promise): Object: {"data":null,"errors":[{"path":null,"locations":[{"line":9,"column":9,"sourceName":null}],"message":"Validation error of type UndefinedFragment: Undefined fragment SheetParts @ 'getList/sheets/items'"}]}`

Am I missing something?

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.