[PR #37] [MERGED] Fix: Removal of brackets for scalar operations #158

Closed
opened 2026-03-15 11:38:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/atulmy/gql-query-builder/pull/37
Author: @Devorein
Created: 6/28/2020
Status: Merged
Merged: 7/1/2020
Merged by: @atulmy

Base: masterHead: scalar-op-bracket-removal


📝 Commits (2)

  • bd95714 Fix: Removal of brackets for scalar operations
  • cd5a881 test: Added tests to validate removal of extraneous brackets

📊 Changes

3 files changed (+163 additions, -5 deletions)

View changed files

📝 src/Utils.ts (+11 -4)
📝 src/adapters/DefaultQueryAdapter.ts (+5 -1)
📝 src/index.test.ts (+147 -0)

📄 Description

ISSUE

  • Previously scalar operations contained { } in the output which resulted in a bad request

Fix

  • if the fields property in the root operation or nested operation is empty ie length === 0 then remove the { }
  • For fields that are object, if that objects value ie field is empty also remove the { }

This is a fix for issue#36

I've also added additional tests as well. Things got a bit messy with strings due to whitespaces ;)


🔄 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/37 **Author:** [@Devorein](https://github.com/Devorein) **Created:** 6/28/2020 **Status:** ✅ Merged **Merged:** 7/1/2020 **Merged by:** [@atulmy](https://github.com/atulmy) **Base:** `master` ← **Head:** `scalar-op-bracket-removal` --- ### 📝 Commits (2) - [`bd95714`](https://github.com/atulmy/gql-query-builder/commit/bd9571487a22079bfb5b42343c3e7150d4a5fc1d) Fix: Removal of brackets for scalar operations - [`cd5a881`](https://github.com/atulmy/gql-query-builder/commit/cd5a881082843e72206e5ea2962d0520be130561) test: Added tests to validate removal of extraneous brackets ### 📊 Changes **3 files changed** (+163 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/Utils.ts` (+11 -4) 📝 `src/adapters/DefaultQueryAdapter.ts` (+5 -1) 📝 `src/index.test.ts` (+147 -0) </details> ### 📄 Description # ISSUE * Previously scalar operations contained `{ }` in the output which resulted in a bad request ## Fix * if the fields property in the root operation or nested operation is empty ie length === 0 then remove the `{ }` * For fields that are object, if that objects value ie field is empty also remove the `{ }` This is a fix for [issue#36](https://github.com/atulmy/gql-query-builder/issues/36) I've also added additional tests as well. Things got a bit messy with strings due to whitespaces ;) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-15 11:38:48 +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#158
No description provided.