[GH-ISSUE #45] Add enum #24

Open
opened 2026-03-03 00:02:49 +03:00 by kerem · 6 comments
Owner

Originally created by @felipe-gustavo on GitHub (Jul 3, 2020).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/45

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

Originally created by @felipe-gustavo on GitHub (Jul 3, 2020). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/45 i have some query that need add Enum like that: ```GraphQL { 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
Author
Owner

@atulmy commented on GitHub (Jul 4, 2020):

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

<!-- gh-comment-id:653769318 --> @atulmy commented on GitHub (Jul 4, 2020): @felipe-gustavo feel free to open a PR for this use case.
Author
Owner

@Devorein commented on GitHub (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']}]
  },
]);

<!-- gh-comment-id:653845982 --> @Devorein commented on GitHub (Jul 5, 2020): @felipe-gustavo can you try the following command ```js 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']}] }, ]); ```
Author
Owner

@Devorein commented on GitHub (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

<!-- gh-comment-id:653846257 --> @Devorein commented on GitHub (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
Author
Owner

@ehrenmurdick commented on GitHub (Nov 11, 2021):

@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?

<!-- gh-comment-id:966602956 --> @ehrenmurdick commented on GitHub (Nov 11, 2021): @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?
Author
Owner

@julienlagorsse-loreal commented on GitHub (Jan 31, 2023):

Same here.

<!-- gh-comment-id:1410491360 --> @julienlagorsse-loreal commented on GitHub (Jan 31, 2023): Same here.
Author
Owner

@ehrenmurdick commented on GitHub (Feb 2, 2023):

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.

<!-- gh-comment-id:1414280790 --> @ehrenmurdick commented on GitHub (Feb 2, 2023): 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 in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#24
No description provided.