Which Category is your question related to?
Graphql Transform
Amplify CLI Version
4.11.0
What AWS Services are you utilizing?
AppSync, Dynamodb
Provide additional details e.g. code snippets
I have a query in my app that requires I believe requires a custom pipeline resolver and I am not sure how to implement it. My schema looks like:
type Student @model {
id: ID
name: String
classes: [StudentClass] @connection(keyName: "byStudent", fields: ["id"])
exams: [StudentExam] @connection(keyName: "byStudent", fields: ["id"])
}
type StudentExam
@model
@key(name: "byExam", fields: ["examID"])
@key(name: "byStudent", fields: ["studentID"]) {
id: ID!
studentID: ID
student: [Student] @connection(fields: ["studentID"])
examID: ID
exam: [Exam] @connection(fields: ["examID"])
}
type Exam @model @key(name: "byClass", fields: ["byClass"]) {
id: ID
classID: ID
class: [Class] @connection(fields: ["classID"])
students: [StudentExam] @connection(keyName: "byExam", fields: ["id"])
avgScore: Float
}
type StudentClass
@model
@key(name: "byStudent", fields: ["studentID"])
@key(name: "byClass", fields: ["classID"]) {
studentID: ID
classID: ID
student: [Student] @connection(fields: ["studentID"])
class: [Class] @connection(fields: ["classID"])
}
type Class @model {
id: ID
name: String
students: [StudentClass] @connection(keyName: "byClass", fields: ["id"])
exams: [Exam] @connection(keyName: "byClass", fields: ["id"])
}
Given a student, I need to be able to query for the list of Exams in the Student's Classes, that the Student is not signed up for. A StudentExam record denotes that a Student is signed up for an Exam in a Class. My solution to this would be to
The docs would seem to recommend writing a custom resolver that targets a dynamodb table generated @model. But the steps outlined above will need to target multiple tables, and so would require a pipeline of resolvers. How can I do that?
I asked the same question a few days ago here:
https://github.com/aws-amplify/amplify-cli/issues/3192
It would be nice to have that in the documentation.
Hello @karrettgelley currently the CLI does not support pipeline resolvers, though this is something we are working on an update for.
Follow this RFC for those updates: https://github.com/aws-amplify/amplify-cli/issues/1055
A few possible implementations are discussed on that thread.
If I understand your question correctly
Closing this issue - If you have any specific questions related to implementing a custom pipeline resolver solution in your project I recommend looking at the thread linked above.
@SwaySway Sorry for the late response. But your assumption is correct. For now, I will try to workaround the problem by rearchitecting the schema. In the future it will be nice to have pipeline resolvers, but I have come up with another solution
Most helpful comment
Hello @karrettgelley currently the CLI does not support pipeline resolvers, though this is something we are working on an update for.
Follow this RFC for those updates: https://github.com/aws-amplify/amplify-cli/issues/1055
A few possible implementations are discussed on that thread.
If I understand your question correctly