[PR #55] [MERGED] feat(variables): take consideration of nested variables #81

Closed
opened 2026-03-03 00:03:20 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/atulmy/gql-query-builder/pull/55
Author: @clement-berard
Created: 12/19/2020
Status: Merged
Merged: 12/20/2020
Merged by: @atulmy

Base: masterHead: add-nested-variables


📝 Commits (3)

📊 Changes

2 files changed (+119 additions, -9 deletions)

View changed files

📝 src/Utils.ts (+23 -9)
📝 src/index.test.ts (+96 -0)

📄 Description

Hello community!

Nested fields have served me well. Nevertheless, the variables for the sub-operations were not added to the variables of the query (only the first sub-operation).

So I propose a small modification to collect all the variables, no matter how deep they are.

Below, the result of the query added in test.

query(
  $id: ID
  $visible: Boolean
  $platformLimit: Int
  $idChannel: Int!
  $channelLimit: Int
  $rightsLimit: Int
  $rightsOffset: Int
  $userLimit: Int
  $userFilter: String
) {
  getPublicationNames {
    publication(id: $id) {
      id
      name
      platforms(visible: $visible, limit: $platformLimit) {
        totalCount
        edges {
          label
          code
          parentId
          id
          rights(
            idChannel: $idChannel
            limit: $rightsLimit
            offset: $rightsOffset
          ) {
            id
            label
            users(limit: $userLimit, filters: $userFilter) {
              id
              name
            }
          }
        }
        subField
        channels(id: $idChannel, limit: $channelLimit) {
          id
          label
        }
      }
    }
  }
}

thanks to all of you :)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/atulmy/gql-query-builder/pull/55 **Author:** [@clement-berard](https://github.com/clement-berard) **Created:** 12/19/2020 **Status:** ✅ Merged **Merged:** 12/20/2020 **Merged by:** [@atulmy](https://github.com/atulmy) **Base:** `master` ← **Head:** `add-nested-variables` --- ### 📝 Commits (3) - [`807b7bb`](https://github.com/atulmy/gql-query-builder/commit/807b7bb189aba6834f36789f99c514209af6f171) update utils - [`1227176`](https://github.com/atulmy/gql-query-builder/commit/1227176864449dac1544381381dd85b479049d07) add tests - [`bf39017`](https://github.com/atulmy/gql-query-builder/commit/bf39017ad7dbac573e53f76cd4ea70f7521b5bdd) add tests ### 📊 Changes **2 files changed** (+119 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/Utils.ts` (+23 -9) 📝 `src/index.test.ts` (+96 -0) </details> ### 📄 Description Hello community! Nested fields have served me well. Nevertheless, the variables for the sub-operations were not added to the variables of the query (only the first sub-operation). So I propose a small modification to collect all the variables, no matter how deep they are. Below, the result of the query added in test. ```graphql query( $id: ID $visible: Boolean $platformLimit: Int $idChannel: Int! $channelLimit: Int $rightsLimit: Int $rightsOffset: Int $userLimit: Int $userFilter: String ) { getPublicationNames { publication(id: $id) { id name platforms(visible: $visible, limit: $platformLimit) { totalCount edges { label code parentId id rights( idChannel: $idChannel limit: $rightsLimit offset: $rightsOffset ) { id label users(limit: $userLimit, filters: $userFilter) { id name } } } subField channels(id: $idChannel, limit: $channelLimit) { id label } } } } } ``` thanks to all of you :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 00:03:20 +03:00
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#81
No description provided.