Tag: graphql-js
-
How do I use schema.graphql file as typeDefs?
3 I am learning GraphQL with Node.js and I am currently using graphql-yoga as a GraphQLServer. Now, I want to seperate Type Definitions and Resolvers so I have used schema.graphql and in there I have all my types defined but now I have no Idea how to use that file as typeDefs in GraphQL Server.…
-
How to eliminate mirroring the records?
0 I’ve got GraphQl code like this : const queryGraphQL = { query: `query { products(searchInput: { parameters: [{ id: 915 values:[4095,4170] } ] }, settingsInput: {limit:35 }) { products { producer{ link name id } awardedParameters { id name values { name link } } } } }`, } const fetchData = async ()…
-
How to define JSON custom scalar type in graphql which can be nullable?
0 https://github.com/graphql/graphql-js/issues/3532#issuecomment-1125126566 serialize() can not return null, so I’m getting GRAPHQL error {"errors":[{"message":"Expected JsonType.serialize("null") to return non-nullable value, returned: null" error where JsonType is my customized scalar. tried to return undefined but it’s not working either. graphql graphql-js Share Follow asked 28 mins ago user22803426user22803426 1 New contributor user22803426 is a new contributor to this…
-
How to make the ApolloClient useQuery method to await
0 const claimableItemId = "5ab7c5ab-7a3d-4a92-a62f-2fbd995955f6"; const destAddr = "0x387961b46242A42B445D4354d5048329410613a7"; const [redeemEarnableItem, { data: redeemItem }] = useMutation( REDEEM_EARNABLE_ITEM, { variables: { claimableItemId, destAddr, }, } ); const [getInvoiceDetails, { loading, data: invoiceDetails, refetch }] = useQuery(GET_INVOICE_DETAILS); const redeemHandler = async () => { try { const redeemItem = await redeemEarnableItem(); const id = redeemItem.data.redeemEarnableItem.invoiceID; console.log(id,…
-
GraphQL usage with REST Endpoints in .Net core 6.0
0 Since I am new to GraphQL, I don’t really know how to call a REST Endpoint and query the fields accordingly. In particular, I want to fetch certain fields from the entire response of a GET API. What I have learnt is GraphQL sends a POST Request. How do I hit the GET endpoints…
-
GraphQL only select items of certain type from array
0 In my GraphQL API I have defined a course fragment with an array property lessons. Initially it only had lessons of type TextLesson. Later we added lessons of type VideoLesson as well. fragment TextLessonFields on TextLesson { title body } #fragment VideoLessonFields on VideoLesson { # title # videoUrl #} fragment CourseFields on Course…
-
GraphQL mutation issue with Enum
0 I have object something like below: type SomeEventInput { event: Event } type Event { type: EventType! } enum EventType { MORNING EVENING AFTERNOON MIDNIGHT } Mutation.SomeEvent(input: SomeEventInput!): Boolean! What i am trying to test it something like : mutation SomeEvent($input: SomeEventInput!) { SomeEventInput(input: {Event: {type: MORNING}}) } But it is showing error for…
-
GraphQL query is not returning the data at the first fetch itself
0 In my NextJS application, I’m using Apollo Client to query the data. This is the code, //Redeem earnable item const claimableItemId = "5ab7c5ab-7a3d-4a92-a62f-2fbd995955f6"; const destAddr = "0x387961b46242A42B445D4354d5048329410613a7"; const [redeemEarnableItem, { data: redeemItem }] = useMutation( REDEEM_EARNABLE_ITEM, { variables: { claimableItemId, destAddr, }, } ); const { loading, error, data: invoiceDetails, } = useQuery(GET_INVOICE_DETAILS, {…
-
How to set timeout to graphql-client
7 I’m trying to set timeout with prisma-labs/graphql-request. I’ve tried the way described here – https://github.com/prisma-labs/graphql-request/issues/103. const client = new GraphQLClient(config.url, { timeout: 30000, headers: { Authorization: `Bearer ${token}` } }) My compiler complains as timeout is not directly present in Options interface – https://github.com/prisma-labs/graphql-request/blob/master/src/types.ts#L7. Should I need to extend the Options interface to use…
-
Graphql “Unknown argument “bookId” on field “book” of type “Explore”.”
0 I’m trying to call my API but it keeps giving me 400 Error request with the error of: message: "Unknown argument "bookId" on field "book" of type "Explore"." I’ve just read the documentation of Apollo graphql and tried to fetch my data the way it said with variables and args, and it’s in my…