aws-amplify / aws-amplify/amplify-codegen

Amplify codegen doesn't support namespace queries/mutations

Open
#776 4 comments 1 reaction 0 assignees View on GitHub
feature-request transferred
Dominant language
TypeScript
Stars
59
Forks
64
PR merge metrics
No merged PRs in 30d

Description

### How did you install the Amplify CLI?

npm

### If applicable, what version of Node.js are you using?

v20.10.0

### Amplify CLI Version

12.8.2

### What operating system are you using?

Mac (also with devcontainers Debian 11 bullseye)

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

N/A

### Describe the bug

Hi, my schema has namespaced queries/mutations and when running `amplify codegen` it's failing when trying to generate types. The following repo https://github.com/sescotti/amplify-namespaced-gql reproduces the issue.

I'm getting the following error:

```bash
node ➜ /workspaces/namespaced-graphql (master) $ amplify codegen
✔ Generated GraphQL operations successfully and saved at src/graphql
⠋ Generating.../GraphQL request: Field "create" argument "input" of type "CreateCustomerInput!" is required, but it was not provided.
.../GraphQL request: Field "create" argument "input" of type "CreateOrderInput!" is required, but it was not provided.
.../GraphQL request: There can be only one operation named "Customer".
.../GraphQL request: There can be only one operation named "Customer".
.../GraphQL request: Field "get" argument "id" of type "ID!" is required, but it was not provided.
.../GraphQL request: There can be only one operation named "Order".
.../GraphQL request: There can be only one operation named "Order".
.../GraphQL request: Field "get" argument "id" of type "ID!" is required, but it was not provided.
✖ Validation of GraphQL query document failed
```

### Expected behavior

GQL types correctly generated

### Reproduction steps

1. (Optional) Open repo in devcontainer
2. Run `amplify codegen`

### Project Identifier

Learn more at https://docs.amplify.aws/cli/reference/diagnose/
⠋ Creating Zip
No Amplify backend project files detected within this folder.
✖ Creating Zip

### Log output

```
# Put your logs below this line

```

### Additional information

Same thing happens when collecting the schema from an existing AppSync API when using the `--apiId` arg

### Before submitting, please confirm:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

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.