Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization of array of custom scalars fails #41

Open
MrFus10n opened this issue Dec 6, 2021 · 0 comments
Open

Serialization of array of custom scalars fails #41

MrFus10n opened this issue Dec 6, 2021 · 0 comments

Comments

@MrFus10n
Copy link

MrFus10n commented Dec 6, 2021

I created custom Time type map like this:

  Time: {
    serialize: (time: moment.Moment) => time.format("HH:mm:ss"),
    deserialize: (time: string) => moment(time, "HH:mm:ss"),
  }

When mutation accepts single Time value, it works ok. But when it accepts array ([Time!]), serialize function receives array of moment objects instead of getting them one by one.

On the screenshot below, time does not have format because time is array of moments, not moment object.

image

Mutation is called like this:

graphqlClient.chain.mutation
  .userProfileUpdate({input: {times: [
    moment("08:00", "HH:mm"),
    moment("14:00", "HH:mm"),
    moment("20:00", "HH:mm"),
  ]}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant