question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

question / feature - generating lists of items within gql statement.

See original GitHub issue

I have a mutation on my Apollo Server which allows for 0-N items in the request. Given the following have you guys any advice on how handle adding 0 or N items ? The base GQL minus the items on the item array is getting correctly generated and being received by my server.

 an_item = {
            "prop": 123,
        }

apply_mutation = gql('''
mutation apply($id: String!, $items: DiscountItemInput!) {
         applyDiscount(
             applyObject: {
              orderId: $id
              storeId: 2             
              items: [
               # can I do variable substitution using a dict here ?
               {
               },
                 .... 0 - N item
              ]
            }
          ) {
           ... list of fields to be returned
          }
        }
       ''')
        params = {
             "Id": 123          
        }
client.execute(apply_mutation, variable_values=params)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Citocommented, May 17, 2020

Also, can you try with the latest v3.0.0a0?

0reactions
KingDarBojacommented, Sep 7, 2020

Closing now for housekeeping purposes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Queries and Mutations - GraphQL
GraphQL queries look the same for both single items or lists of items; however, we know which one to expect based on what...
Read more >
How to query list of objects with array as an argument in ...
Show activity on this post. I'm trying to query a list of objects having array of IDs. Something similar to following SQL query:...
Read more >
Query syntax | BigQuery - Google Cloud
Query statements scan one or more tables or expressions and return the computed result rows. This topic describes the syntax for SQL queries...
Read more >
TOP-70 Most Important SQL Queries in 2022 - ByteScout
SQL Query for Retrieving Tables. This query can be run to retrieve the list of tables present in a database where the database...
Read more >
Best practices for writing SQL queries - Metabase
The SQL editor in Metabase features a handy data reference tab (accessible via the book icon), where you can browse through the tables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found