graphql-editor / graphql-zeus

GraphQL client and GraphQL code generator with GraphQL autocomplete library generation ⚡⚡⚡ for browser,nodejs and react native ( apollo compatible )
https://graphqleditor.com/docs/tools/zeus/index/
MIT License
1.93k stars 104 forks source link

Error encoding arrays of custom scalars #346

Open IgnisDa opened 1 year ago

IgnisDa commented 1 year ago

Awesome project!

I have a UUID scalar in my graphql schema and someMutation expects [UUID!]! as an input. But when I call the following query:

await gqlSdk('mutation', { scalars })({
   someMutation: [{ ids: [] }, { status: true }]
})

Then the generated query is:

mutation {
   someMutation(id: "") { status } 
}

And the following query generates:

await gqlSdk('mutation', { scalars })({
   someMutation: [{ ids: [uuidv4(), uuidv4()] }, { status: true }]
})
mutation {
   someMutation(id: "dac0b13f-6929-402b-a085-6386db357739,59010d30-0416-47b7-8b21-6f955780e987") { status } 
}

Here is what my scalars looks like

export const scalars = ZeusScalars({
  UUID: {
    encode: (e: unknown) => String(`"${e}"`),
    decode: (e: unknown) => e as string,
  },
});

I expect these scalars to be encoded correctly.

Am I doing something wrong or is this a bug?

IgnisDa commented 1 year ago

Probably got something to do with this line: https://github.com/graphql-editor/graphql-zeus/blob/0e908549932312dee2857cdd9dc47401e42fb120/src/TreeToTS/functions/new/resolvePath.ts#L139

aexol commented 1 year ago

ok looking into it now

aexol commented 1 year ago

What it lacks are tests.

MurmeltierS commented 12 months ago

this still seems to be an issue, correct? amount is of Scalar Type "Money".

image

ogil7190 commented 11 months ago

@IgnisDa is this still active?

IgnisDa commented 11 months ago

@ogil7190 no idea. I am not a maintainer.

ogil7190 commented 11 months ago

@MurmeltierS is this still open to work?

MurmeltierS commented 11 months ago

@ogil7190 also not a maintainer but it seems to me like this issue is still persisting

Vishal-Sikka commented 11 months ago

/attempt #346