Here is my GQL... (note the variable $rrule
)
mutation CREATE(
$title: String!,
$description: String!,
$duration: interval!,
$photo_url: String,
$rrule: String!,
$venue_id: Int!
) {
result:insert_event_templates_one(
object: {
title: $title,
description: $description,
duration: $duration,
photo_url: $photo_url,
rrule: $rrule,
venue_id: $venue_id
}
) {
id
}
}
rrule is a custom column type in another schema: _rrule
It can an implicit cast defined as follows:
CREATE CAST (TEXT AS _rrule.RRULE)
WITH FUNCTION _rrule.rrule(TEXT)
AS IMPLICIT;
How do I define my mutation to reference that cast? Right now when I run this mutation I get the following error:
variable rrule of type String! is used in position expecting rrule
So Hasura seems to know the underlying column type, but can't use its implicit cast?
The error does not have anything to do with the underlying datasource. The argument where the $rrule
variable is being used accepts a GraphQL type named rrule
. A variable can only be passed to an argument if its type matches. So the type of $rrule
must be the same as the type of the argument rrule
-- that is, it's type should also be rrule
.
mutation CREATE(
$rrule: rrule!
...
) {
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.