[PR #2578] [MERGED] feat: allow quoted key/values for escaping characters and trail/lead whitespaces in raw key value pairs #3911

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/2578
Author: @AndrewBastin
Created: 8/12/2022
Status: Merged
Merged: 8/12/2022
Merged by: @liyasthomas

Base: mainHead: fix/2577


📝 Commits (4)

  • 70a7b90 feat: add recordUpdate utility function
  • 167817d feat: add ability to use special characters and leading/trailing spaces in raw key value strings
  • 5288f96 chore: bump hopp-data version
  • 63f8bd9 fix: add forced quoting if a special character is present in the entry

📊 Changes

7 files changed (+392 additions, -80 deletions)

View changed files

📝 packages/hoppscotch-app/package.json (+1 -1)
📝 packages/hoppscotch-cli/package.json (+1 -1)
📝 packages/hoppscotch-data/package.json (+1 -1)
📝 packages/hoppscotch-data/src/rawKeyValue.ts (+65 -6)
packages/hoppscotch-data/src/utils/record.ts (+17 -0)
📝 packages/hoppscotch-js-sandbox/package.json (+1 -1)
📝 pnpm-lock.yaml (+306 -70)

📄 Description

This PR implements ability for Raw Key Value pairs to include escape characters for parsing leading and trailing whitespaces and other special characters which may be present in a raw key or value.

Closes #2577

Description

With the introduction of this PR, quotations will be allowed in Raw Key Value grammar

hello: world
"quoted hello": "quoted world"

This will be parsed into the following AST representation

[
  { "active": true, "key": "hello", "value": "world" },
  { "active": true, "key": "quoted hello", "value": "quoted world" }
]

This allows for representing weird characters, trailing and leading whitespaces and use of key symbols of the grammar (like # and :) within the key/value strings. Along with that, escape characters are also recognized and parsed into the AST representation when used within quotes (the syntax highlighting grammar for it is a bit weird though, issue tracked on hoppscotch/internal-issues#24).

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information

None of the previously considered to be valid key value pairs will be broken with this update.


🔄 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/hoppscotch/hoppscotch/pull/2578 **Author:** [@AndrewBastin](https://github.com/AndrewBastin) **Created:** 8/12/2022 **Status:** ✅ Merged **Merged:** 8/12/2022 **Merged by:** [@liyasthomas](https://github.com/liyasthomas) **Base:** `main` ← **Head:** `fix/2577` --- ### 📝 Commits (4) - [`70a7b90`](https://github.com/hoppscotch/hoppscotch/commit/70a7b90db96c931d0841304e518bd7dedeb2f536) feat: add recordUpdate utility function - [`167817d`](https://github.com/hoppscotch/hoppscotch/commit/167817d457b60237c8aa7e1cbfd5e108c8378813) feat: add ability to use special characters and leading/trailing spaces in raw key value strings - [`5288f96`](https://github.com/hoppscotch/hoppscotch/commit/5288f966e09c810f80d4400f5684ea48d271d169) chore: bump hopp-data version - [`63f8bd9`](https://github.com/hoppscotch/hoppscotch/commit/63f8bd990895acdccd5910e83a3b687735331b7e) fix: add forced quoting if a special character is present in the entry ### 📊 Changes **7 files changed** (+392 additions, -80 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-app/package.json` (+1 -1) 📝 `packages/hoppscotch-cli/package.json` (+1 -1) 📝 `packages/hoppscotch-data/package.json` (+1 -1) 📝 `packages/hoppscotch-data/src/rawKeyValue.ts` (+65 -6) ➕ `packages/hoppscotch-data/src/utils/record.ts` (+17 -0) 📝 `packages/hoppscotch-js-sandbox/package.json` (+1 -1) 📝 `pnpm-lock.yaml` (+306 -70) </details> ### 📄 Description This PR implements ability for Raw Key Value pairs to include escape characters for parsing leading and trailing whitespaces and other special characters which may be present in a raw key or value. Closes #2577 ### Description With the introduction of this PR, quotations will be allowed in Raw Key Value grammar ```yaml hello: world "quoted hello": "quoted world" ``` This will be parsed into the following AST representation ```json [ { "active": true, "key": "hello", "value": "world" }, { "active": true, "key": "quoted hello", "value": "quoted world" } ] ``` This allows for representing weird characters, trailing and leading whitespaces and use of key symbols of the grammar (like `#` and `:`) within the key/value strings. Along with that, escape characters are also recognized and parsed into the AST representation when used within quotes (the syntax highlighting grammar for it is a bit weird though, issue tracked on hoppscotch/internal-issues#24). ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [x] I have updated the documentation as required - [x] All the tests have passed ### Additional Information None of the previously considered to be valid key value pairs will be broken with this update. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:29: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/hoppscotch#3911
No description provided.