Apologies if this question doesn't belong here..
Imagine the schema:
type School {
schoolId: String
schoolName: String
schoolAddress: Address
classes: [Class]
}
type Class {
classId: String
className: String
classRoomNumber: Int
students: [Student]
}
type Student {
studentId: String
studentName: String
grade: Int
}
Is there a way of getting schoolId from within the resolver for Student (without specifying it as a parameter)?
I see that I can get/set on: dataFetchingEnvironment.dataGraphQLContext.subject.publicCredentials to use it as a sort of fetching context to pass things to lower level resolvers.
The issue is this 'subject' is very security specific and I don't want to use it for general purpose key -> value data.
I assume I can create my own implementation of the DataFetchingEnvironment that returns a GraphQLContext wrapper or something, but I wanted to be sure:
- This hasn't been done and I just cant find it
- This context is per request and thread safe?
I'm assuming I'm missing something about why this is a horrible idea. If it exists for security specific metadata, I would think it would also exist for general data?
Apologies if this question doesn't belong here..
Imagine the schema:
Is there a way of getting
schoolIdfrom within the resolver for Student (without specifying it as a parameter)?I see that I can get/set on:
dataFetchingEnvironment.dataGraphQLContext.subject.publicCredentialsto use it as a sort of fetching context to pass things to lower level resolvers.The issue is this 'subject' is very security specific and I don't want to use it for general purpose key -> value data.
I assume I can create my own implementation of the
DataFetchingEnvironmentthat returns a GraphQLContext wrapper or something, but I wanted to be sure:I'm assuming I'm missing something about why this is a horrible idea. If it exists for security specific metadata, I would think it would also exist for general data?