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

Use EnumType in Object-Parameter #22

Closed
mertins-codamic opened this issue Apr 2, 2020 · 3 comments
Closed

Use EnumType in Object-Parameter #22

mertins-codamic opened this issue Apr 2, 2020 · 3 comments

Comments

@mertins-codamic
Copy link

Hey @dupski,
thank you for this lib. It's exactly what i was looking for. But now i'm stuck by passing EnumTypes in Objects as Parameter.

const query = {
  mutation: {
    create: {
      __aliasFor: 'createPost',
      __args: {
        initial: {title: "XYZ" , status: new EnumType("OPEN")},
      },
      id: true,
    },
  },
};

results in:
mutation { create: createPost (initial: {title: "XYZ", status: {value: "OPEN"}}) { id }}

expected:
mutation { create: createPost (initial: {title: "XYZ", status: OPEN}) { id }}

Can you help here? Thanks :)

@mertins-codamic
Copy link
Author

Additional Info: I figure out why this happens.
I used EnumType from other package. (Core-Lib imports json-to-graphql-query and project itself import EnumType, so "instanceof" does not match.
Fix it by using:
export {EnumType as EnumType} from 'json-to-graphql-query';
in my index.js in Core-Lib.

@dupski
Copy link
Collaborator

dupski commented Apr 18, 2020

Glad you sorted it @mertins-codamic :)

@tdelabro
Copy link

tdelabro commented Dec 9, 2022

@dupski I'm having this exact behaviour.

I'm importing import { EnumType } from 'json-to-graphql-query';
in one file, and import { jsonToGraphQLQuery } from 'json-to-graphql-query';
in another one.

See #60

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

3 participants