I'm working to create a web app using Amplify, and would like to create a relationship between two tables to keep things DRY. I have 2 tables: Listing and Service. Each Listing should be related to one Service. My (abbreviated) schema looks like this. All queries / resolvers are auto-generated by amplify push
type Listing
@model
@auth(rules: [{ allow: public, operations: [read] }])
{
id: ID!
status: Status
source: String
service: String
serviceDetail: Service @connection (keyName: "service")
}
type Service @model {
id: ID!
name: String
homepage: AWSURL
logo: String
}
To eliminate any other issues, I'm running my tests in the AppSync Console.
Running the ListServices query returns all expected data from the Service table without any errors. Running a getService query on a specific id returns the expected data without any errors.
Running the ListListings query returns with no errors and all expected data from the Listings table. The serviceDetail field only contains null.
I've been digging through the documentation all morning, and can't figure out what's wrong.
So, I defined the
@connectionwrong. The correct syntax is: