Custom types and arrays not supported in action handlers

Viewed 207

I am new to action handlers in Hasura and can not see a way to return a custom type or an array of a type.

In a query, the output type below returns "states": "[\"hello\", \"world\"]"

type Output {
  states : [String]
}

I have found it also isn't possible return custom types, for example the below passes the UI checks in the console but fails when it tries to apply it to the action.

type Options {
   value: String
   name: String
}
type Output {
  states : [Options]
}
validation for the given custom types failed because the type "Options" of the field "states" in the object type "Output" is object type which isn't allowed

I'm assuming there is a way around this but I can't see it in the docs or on any tutorials. I do use relationships for some parts of my handlers, however there are more times where I want to return custom data to protect the data in the database, or transform it using business logic.

Is there a way to achieve arrays or custom types in action handlers? I have reached out to Hasura support and created an issue on their repo but without any reply/feedback.

0 Answers
Related