#graphql `@default` directive - not working?

5 messages · Page 1 of 1 (latest)

sonic hamlet
#

Did this in graphql.schema

qty: Int @default(value: "0")

And got this error after amplify push

✖ An error occurred when pushing the resources to the cloud
🛑 An error occurred during the push operation: Unknown directive "default".

Unknown directive "default".

and yet AWS documentation shows
https://docs.amplify.aws/cli/graphql/data-modeling/#assign-default-values-for-fields

Steps Taken:

  1. Amplify CLI version is at the latest version i.e. 6..4.0
  2. npm i @aws-amplify/graphql-default-value-transformer
fluid knot
#

how did you install the CLI? the latest version is 11.1.1. this is how I get the latest version: npm -g install amplify-cli@latest

gentle vale
#

in addition to Ducky's note, what does the contents of your amplify/cli.json look like? You'll want to ensure graphqltransformerversion is set to 2, along with useexperimentalpipelinedresolver to true

#

this directive is supplied out-of-the-box, so you won't need to install it manually

sonic hamlet