In AWS Amplify CLI when you add a GrpahQL API with
amplify add api
you are asked for the max level depth of the generated code. The default nested level is 3.
In my case it turns out that the max depth is not enough and I need to increase it.
Is there a way to do that?
I'we tried to run
amplify update api
However I wasn't asked again about the maximum level depth of the generated code during the process of the update.
Finally I've found the solution in this github asnwer.
Turns out that the file .graphqlconfig.yml
is responsible for the AWS Amplify GraphQL API.
The property projects.YOUR-API-NAME.extensions.amplify.maxDepth
is responsible for changing the nested level depth for the codegenerator. Now my .graphqlconfig.yml
file looks in the following way and it works:
projects:
YOUR-API-NAME:
schemaPath: amplify/backend/api/zlmvp/build/schema.graphql
includes:
- src/graphql/**/*.ts
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: typescript
generatedFileName: src/API.ts
docsFilePath: src/graphql
maxDepth: 5
extensions:
amplify:
version: 3