Reputation: 6911
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?
Upvotes: 0
Views: 235
Reputation: 84727
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!
...
) {
...
}
Upvotes: 1