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

Add enum #45

Open
felipe-gustavo opened this issue Jul 3, 2020 · 6 comments
Open

Add enum #45

felipe-gustavo opened this issue Jul 3, 2020 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@felipe-gustavo
Copy link

i have some query that need add Enum like that:

{
  diagnostic__defects(page: 1, orderBy: [{field: IS_FUNCTIONAL_DEFECT, order: DESC}]) {
    data {
      id
      name
    }
  }
}

IS_FUNCTIONAL_DEFECT and DESC are ENUM, can't be wrapped by quote

@atulmy atulmy added the help wanted Extra attention is needed label Jul 4, 2020
@atulmy
Copy link
Owner

atulmy commented Jul 4, 2020

@felipe-gustavo feel free to open a PR for this use case.

@Devorein
Copy link
Contributor

Devorein commented Jul 5, 2020

@felipe-gustavo can you try the following command

const gqlquery = query([
  {
    operation: "diagnostic__defects",
    variables: {
      page: {
        value: 1
      },
      orderBy:{
        list: true,
        type: 'type your order input value here, defined in the schema',
        value: {field: 'IS_FUNCTIONAL_DEFECT', order: 'DESC'}
      }
    },
    fields: [{'data':['id','name']}]
  },
]);

@Devorein
Copy link
Contributor

Devorein commented Jul 5, 2020

@felipe-gustavo Atm there is no way to embed argument values directly, but hopefully the above will work, otherwise I'll send a PR to embed argument values directly without using variables

@ehrenmurdick
Copy link

@Devorein @atulmy I have the same use case. The above command you posted did not work for me. Has there been any update on this?

@julienlagorsse-loreal
Copy link

Same here.

@ehrenmurdick
Copy link

To spare the sanity of anyone else who might resort to reading the graphql spec like me, no the graphql spec doesn't say that the server must accept strings in the variables transport for enum values. It specifically says it may accept strings. The relevant section is here: https://spec.graphql.org/October2021/#sec-Enums.Input-Coercion

I think I have enough time today to implement a PR for this so I'm working on it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants