amplify-codegen icon indicating copy to clipboard operation
amplify-codegen copied to clipboard

Amplify codegen doesn't support namespace queries/mutations

Open sescotti opened this issue 1 year ago • 3 comments

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:

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.

sescotti avatar Dec 24 '23 11:12 sescotti

Hey, 👋 thanks for raising this! I'm going to transfer this over to our codegen repository for better assistance 🙂.

ykethan avatar Dec 27 '23 15:12 ykethan

hi @ykethan! could you provide a link to follow this on the other repo? thanks!

sescotti avatar Dec 28 '23 19:12 sescotti

Hi @sescotti, the issue was transferred from amplify-cli to amplify-codegen. The same thread is preserved when an issue is transferred (a new ticket is not created).

dpilch avatar Jan 09 '24 17:01 dpilch