I just can't seem to get lists of scalars working ...
# orm-help
n
I just can't seem to get lists of scalars working in Prisma
n
that's a shame 🙂
n
Haha
On the bright side, I've gotten some pretty complex relationships working beautifully 🙂
💯 1
Just don't know what I'm missing - been checking the docs and forums
n
what are you trying to accomplish and what's your current state? 🙂
n
I'm trying to store an array of strings on a record. I'm using the mysql connector. I thought it was possible to store a list of scalars, but I realize I'm missing something.
n
You can store a list of Strings. What's your datamodel, your mutation and any responses/error messages you receive?
n
On the type in Prisma datamodel.graphql:
Copy code
type Game {
  description: [String!]!
}
In my schema.graphql file:
Copy code
type Mutation {
  createGame(description: [String]!)
}
Error:
Field "2" is not defined by type GameCreatedescriptionInput at value.description
n
That sounds like a JS error. Does it work when directly running the mutation against the Prisma API?
n
Hmm I'll check
n
If yes, please share the debug output that contains the verbatim query sent to Prisma from
prisma-binding
(assuming you're using that)
n
Yes I'm using prisma-binding. It actually didn't work when testing directly against the Prisma API. I thought I got the format correct, but the error was
Expected 'GameCreatedescriptionInput', found not an object.
I can share the entire output it'll just be kind of big
n
can you PM me your service information and the query that reproduces this?
n
Yes, just sent you the mutation. Will send the service info
n
Ah. Can you please check if adding an
id: ID! @unique
or any other field like
a: Int!
to
Game
fixes this?
If so, please document the issue + workaround here: https://github.com/graphcool/prisma/ 🙂
n
The type already has an
id: ID! @unique
field
n
this is what you shared, was that only the short version?
Copy code
type Game {
  description: [String!]!
}
n
Sorry, yes, heavily truncated 😕 I apologize! Just didn't want to share the huge type def here. I pm'd you the mutation, I'll pm you the type def in my datamodel.graphql file
sent
the
description
field is the only field I'm having issues with. Everything else is working perfectly
n
ok, I'm not be able to take a deep look into this now, but it sounds like something unexpected in your datamodel which leads to an empty input type being generated (or another "degeneration" of the input type)
n
interesting. No problem, I appreciate you hopping in to help! I sent you everything via slack DM so you have it whenever you're able to take a look. Thanks again!
n
awesome, thanks! one other thought, can you check if this happens with a type that just has an id and a list of strings? Then this would be a super easy reproduction. Otherwise I'll take a look at your specific datamodel when I find the time 🙂
n
Good call, I will do that!
Tested with the simple data type, error persists. I'll share that instead of the big ones I shared
🙌 1
w
Keep in mind that scalar lists aren’t filterable yet though ! https://github.com/graphcool/prisma/issues/1275
n
@weakky ended up being programmer error 😞 Simply forgot the "set" field in the mutation being sent to Prisma. I swear I've read the docs completely, but I must have just missed that!
w
Aren’t you using Typescript generated definitions ?
n
No. I had everything configured correctly in my type defs, I just missed that detail in my resolver—I did not know what when I am storing an array of scalars, I need to map the field to an object with a "set" property that contains the array of scalars