Closed HaveF closed 7 years ago
No, it's not a typo. Here's the userId
property in the posts schema:
userId: {
type: String,
optional: true,
control: "select",
viewableBy: ['guests'],
insertableBy: ['members'],
hidden: true,
resolveAs: 'user: User',
}
So posts have a userId
property that's a string. If you add resolveAs: 'user: User'
, in addition to that userId
, posts will also have a user
property that resolves as an object of type User
.
If instead I wrote resolveAs: 'foo: Bar'
, I would have a foo
property of type Bar
. I hope that answers your question :)
Wow! what a fast reply! Totally get the idea! Thanks!
After reading your webpage, I become a fan of yours. 哈哈,我是来自中国的粉丝:smile: 希望我能学的更多,早日对这个项目有贡献
欢迎!如果有什么问题,你也可以加入我们的Slack :)
Thanks for making this repo:+1: I'm trying to go through all the doc.
In schemas.md#resolveas
I did not get
userId
, maybe this should beUser
inPosts
schema to corresponduser
in GraphQL schema?The
User
anduser
confused me...The below means If I do not useresolveAs
, but useGraphQLSchema.addSchema
, allUser
property inPosts
schema will convert toUser
as GraphQL type. Do I understand correctly?