* Which Category is your question related to? *
generated code
* What AWS Services are you utilizing? *
amplify
* Provide additional details e.g. code snippets *
I have this schema
type Product @model {
id: ID!
name: String!
description: String!
image: S3Object!
category: Category
price: Float!
}
the generated query code
export const listProducts = `query ListProducts(
$filter: ModelProductFilterInput
$limit: Int
$nextToken: String
) {
listProducts(filter: $filter, limit: $limit, nextToken: $nextToken) {
items {
id
name
description
category
price
}
nextToken
}
}
*There is no image field *
@NuruddinBadawi Could you answer the following questions
amplify -v<project-root>/.graphqlconfig.yml look like. Please make sure to obfuscate API Key and endpoints. yeh sure
❯ amplify -v
1.6.5
.graphqlconfig.yml
projects:
albaitotiapp:
schemaPath: src/graphql/schema.json
includes:
- src/graphql/**/*.js
excludes:
- ./amplify/**
extensions:
amplify:
graphQLApiId: ___
codeGenTarget: javascript
generatedFileName: ''
docsFilePath: src/graphql
region: eu-central-1
maxDepth: 2
endpoints:
prod: >-
https://___.appsync-api.eu-central-1.amazonaws.com/graphql
@NuruddinBadawi thank you for your response. Could you also share the full schema. I see some types like Category and S3Objects are missing in the shared schema.
type Product @model @searchable {
id: ID!
name: String!
description: String!
image: S3Object!
menu: Menu @connection(name: "ProductsMenu")
category: Category
price: Float!
}
type User
@model(
mutations: { create: "registerUser", update: "updateUser" }
subscriptions: null
) {
id: ID!
username: String!
name: String!
email: String!
phone: String!
registered: Boolean
address: [UserAddress]
orders: [Order] @connection(name: "UserOrders", sortField: "createdAt")
}
type Order @model(mutations: { create: "createOrder", update: "updateOrder" }) {
id: ID!
user: User @connection(name: "UserOrders")
status: OrderStatus!
items: [OrderItem] @connection(name: "OrderItems")
pickup: Boolean!
pickupTime: String
shippingAddress: ShippingAddress
createdAt: AWSDateTime!
note: String
}
type OrderItem @model {
id: ID!
quantity: Int!
price: Float!
otherItemDetails: String
order: Order @connection(name: "OrderItems")
product: Product
}
type Menu @model {
id: ID!
date: AWSDate!
products: [Product]! @connection(name: "ProductsMenu")
}
type S3Object {
bucket: String!
region: String!
key: String!
}
type ShippingAddress {
city: String!
country: String!
address: String!
}
type UserAddress {
name: String!
city: String!
country: String!
address: String!
isShippingAddress: Boolean!
}
enum OrderStatus {
CANCELED
COMPLETED
ONHOLD
PROCESSING
}
enum Category {
starters
soups
salads
main
desserts
}
By the way I remove category table, i use it as a enum
On 29 Apr 2019 Mon at 20:05 Yathiraj notifications@github.com wrote:
@NuruddinBadawi https://github.com/NuruddinBadawi thank you for your
response. Could you also share the full schema. I see some types like
Category and S3Objects are missing in the shared schema.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/aws-amplify/amplify-cli/issues/1359#issuecomment-487662011,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLYQSRMEWP2HKAC6SH7URDPS4TERANCNFSM4HI4BGAA
.
The issue is due to the fact, the maxDepth is set to 2 in your .graphqlconfig.yml. You should see it generate missing field if you increase the maxDepth to 3. You can do this by running amplify codegen configure and setting Enter maximum statement depth [increase from default if your schema is deeply nested] to 3
I see, thank you
@yuth I see the maxDepth can make quires more depth but what about if we need the mutations also has depth level?
I add issue and not solve it until now https://github.com/aws-amplify/amplify-js/issues/3178
thanks for your helping.
Most helpful comment
The issue is due to the fact, the
maxDepthis set to 2 in your.graphqlconfig.yml. You should see it generate missing field if you increase themaxDepthto 3. You can do this by runningamplify codegen configureand settingEnter maximum statement depth [increase from default if your schema is deeply nested]to3