aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
89 stars 79 forks source link

Custom queries/mutations lack schema support #2936

Open bkasten-rbi opened 1 month ago

bkasten-rbi commented 1 month ago

Environment information

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Max
  Memory: 254.86 MB / 32.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn: 1.22.22 - /opt/homebrew/bin/yarn
  npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
  pnpm: 9.5.0 - ~/Library/pnpm/pnpm
NPM Packages:
  @aws-amplify/auth-construct: 1.3.1
  @aws-amplify/backend: 1.4.0
  @aws-amplify/backend-auth: 1.2.0
  @aws-amplify/backend-cli: 1.2.9
  @aws-amplify/backend-data: 1.1.4
  @aws-amplify/backend-deployer: 1.1.4
  @aws-amplify/backend-function: 1.6.0
  @aws-amplify/backend-output-schemas: 1.2.0
  @aws-amplify/backend-output-storage: 1.1.2
  @aws-amplify/backend-secret: 1.1.3
  @aws-amplify/backend-storage: 1.2.1
  @aws-amplify/cli-core: 1.1.3
  @aws-amplify/client-config: 1.4.0
  @aws-amplify/deployed-backend-client: 1.4.1
  @aws-amplify/form-generator: 1.0.3
  @aws-amplify/model-generator: 1.0.8
  @aws-amplify/platform-core: 1.1.0
  @aws-amplify/plugin-types: 1.3.0
  @aws-amplify/sandbox: 1.2.2
  @aws-amplify/schema-generator: 1.2.4
  aws-amplify: 6.6.0
  aws-cdk: 2.158.0
  aws-cdk-lib: 2.158.0
  typescript: 5.3.3
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Describe the bug

a.mutation().arguments({
  id: a.id(),
  items: a.ref('Item').array()
})

When using custom queries/mutations like the above, the arguments are not valid to the typescript requirements. It seems that arguments are limited to primitives and lack support for things like arrays, references and custom types. This appears to be a blocker for us. Are there any work arounds?

Reproduction steps


a.mutation().arguments({
  id: a.id(),
  items: a.ref('Item').array()
})
ykethan commented 1 month ago

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

bkasten-rbi commented 1 month ago

@chrisbonifacio any update here? This is severely limiting the usability of creating custom mutations.

AnilMaktala commented 1 month ago

Hey @bkasten-rbi, I will this with the Engineering team today and provide an update.

chrisbonifacio commented 1 month ago

Hi @bkasten-rbi The team is currently looking into supporting this feature. Unfortunately, I don't have an update on the current progress at the moment.

bkasten-rbi commented 3 weeks ago

@chrisbonifacio @AnilMaktala any update? This is quite literally table stakes functionality. I can't comprehend how the various other features I've seen committed in the last 2 weeks were higher priority than having proper support for primitive arguments.

AnilMaktala commented 3 weeks ago

Hi @bkasten-rbi, The engineering team is actively working on this feature and will update you once it's released.

bkasten-rbi commented 5 days ago

@AnilMaktala any status updates here?