Fork me on GitHub
#graphql
<
2022-03-23
>
fabrao18:03:29

hello, is there any way to receive a hashmap array as argument of mutation in lacinia?

isak19:03:13

@fabrao I think you'd have to do it as a string (e.g., JSON). GraphQL spec limitation, not Lacinia.

fabrao19:03:04

today I'm using string json to perser in back end, is that correct?

isak19:03:29

Yes I think that is the only way

gklijs20:03:45

Using a JSON scalar type would probably be more neat, but comes with the disadvantages of scalar types. Or have a list with something like key/value elements, preferably better named for the purpose.

1
Lennart Buit22:03:23

You can also model your input, as a plain input type, and require a list of that input as an argument to your mutation. JSON scalars - to me - would be for unstructured data. So it depends on how structured your input actually is ^^

fabrao11:03:13

Is that possible to do it in lacinia ?

Lennart Buit12:03:30

yes — you can just define :input-objects, for structured data, or a custom scalar for JSON

fabrao12:03:12

I think it will solve my problems, thank you