Hi!
Given a schema:
type User {
birthDate: Time!
age: Int @resolver(name:"user_age")
}
Schema passes validation when uploaded to fauna.
In the docs it’s specified that @resolver directive on fields is ignored.
But, the directive ends up in the User
Collection ['data', 'gql', 'meta']
ref: Collection("User"),
...
data: {
gql: {
ts: Time("..."),
meta: {
name: "User",
fields: [
{
name: "age",
directives: [
{
name: "resolver",
args: {
name: "user_age"
}
}
],
type: {
Named: "Int"
}
},
{
name: "birthDate",
type: {
NotNull: {
Named: "Date"
}
}
}
],
}
}
}
}
- Now, if we create an UDF
user_age
like thename
field of the@resolver
directive above. No matter the body of the UDF, the graphQL query will returnnull
on that field. If we update thegql
field in the UDFdata
as seen in theMutation
resolvers:
Update(Function("user_age"), {
data: {
gql: {
ts: Now(),
meta: {
location: "User",
field: {
name: "age",
directives: [
{
name: "resolver",
args: {
name: "user_age",
paginated: false
}
}
],
type: {
NotNull: {
Named: "Int"
}
}
}
}
}
}
})
This will now break all graphql functionality. Any graphql call will result in the response:
{
"errors": [
{
"message": "An internal server error occurred. Please contact Fauna support."
}
]
}
If we remove the gql
field we inserted above, we can resume normal opperations.
Update(Function("user_age"), {
data: {
gql: null
}
})
I know this is not a feature yet, but, just something I find interesting.