[PR #419] [MERGED] Support comments in JSON body #1609

Closed
opened 2026-05-06 19:38:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/419
Author: @gschier
Created: 3/5/2026
Status: Merged
Merged: 3/5/2026
Merged by: @gschier

Base: mainHead: json-comments


📝 Commits (8)

  • 2247d8b Hooked up jsonc language mode for Codemirror
  • a821c0a Update JSON formatter to work with jsonc comments
  • 2cf70c1 Function to strip JSON comments
  • 8bb4d9c Strip JSON comments for grpc and graphql vars
  • ed6f9f8 Strip JSON comments for WS requests
  • c340a7d Auto-fix JSON comments and trailing commas for HTTP request bodies
  • f61fdea Merge branch 'main' into json-comments
  • d1a24d2 Address review comments: strict JSON lint and deduplicate GraphQL GET params

📊 Changes

22 files changed (+954 additions, -161 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates-cli/yaak-cli/src/plugin_events.rs (+5 -59)
📝 crates-tauri/yaak-app/src/lib.rs (+3 -0)
📝 crates-tauri/yaak-app/src/render.rs (+2 -62)
📝 crates-tauri/yaak-app/src/ws_ext.rs (+5 -2)
📝 crates/yaak-common/src/serde.rs (+7 -0)
📝 crates/yaak-http/Cargo.toml (+1 -0)
📝 crates/yaak-http/src/types.rs (+120 -12)
📝 crates/yaak-templates/src/format_json.rs (+235 -6)
📝 crates/yaak-templates/src/lib.rs (+1 -0)
crates/yaak-templates/src/strip_json_comments.rs (+318 -0)
📝 crates/yaak/src/render.rs (+59 -1)
📝 package-lock.json (+11 -0)
📝 src-web/components/GrpcEditor.tsx (+2 -2)
📝 src-web/components/HttpRequestPane.tsx (+4 -9)
src-web/components/JsonBodyEditor.tsx (+122 -0)
📝 src-web/components/core/Editor/Editor.tsx (+5 -0)
📝 src-web/components/core/Editor/extensions.ts (+11 -6)
📝 src-web/components/core/Editor/json-lint.ts (+10 -2)
📝 src-web/components/graphql/GraphQLEditor.tsx (+1 -0)

...and 2 more files

📄 Description

You can now comment out parts of the UI (cmd+/) to enable/disable parts of your request body. This also works for WebSocket/gRPC messages, as well as the GraphQL variables editor.

When the request is sent, comments will be stripped and any trailing commas will also be removed before sending. This auto-fix behavior can be disabled within the request body editor if you actually need to send literal commented-JSON to the server.

image
  • Add JSONC (JSON with Comments) support across all request types: HTTP, gRPC, GraphQL, and WebSocket
  • New JsonBodyEditor component with an "Automatically Fix JSON" toggle that strips comments and trailing commas before sending (enabled by default)
  • Configurable JSON linter that adapts based on the auto-fix setting — lenient when on, strict when off
  • Strip trailing commas left behind when commenting out the last JSON property
  • Fix JSON formatter incorrectly pulling standalone comments onto the previous line

Closes https://yaak.app/feedback/posts/allow-commenting-json-body


🔄 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/mountain-loop/yaak/pull/419 **Author:** [@gschier](https://github.com/gschier) **Created:** 3/5/2026 **Status:** ✅ Merged **Merged:** 3/5/2026 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `json-comments` --- ### 📝 Commits (8) - [`2247d8b`](https://github.com/mountain-loop/yaak/commit/2247d8b1588bb2a992bc47719b65d5f6cdb3d4f3) Hooked up jsonc language mode for Codemirror - [`a821c0a`](https://github.com/mountain-loop/yaak/commit/a821c0aba6cba03080ee2427320d6cc339c7ba06) Update JSON formatter to work with jsonc comments - [`2cf70c1`](https://github.com/mountain-loop/yaak/commit/2cf70c17713c0c6ed6c7df8f78bc42bb15cb71b0) Function to strip JSON comments - [`8bb4d9c`](https://github.com/mountain-loop/yaak/commit/8bb4d9cb5e1cc137f5d0929f5a3df45c75c340bf) Strip JSON comments for grpc and graphql vars - [`ed6f9f8`](https://github.com/mountain-loop/yaak/commit/ed6f9f8bd0adabc5e6591864c4cb6a50609c7921) Strip JSON comments for WS requests - [`c340a7d`](https://github.com/mountain-loop/yaak/commit/c340a7d5ae24fcc1a32296ef4b9a40e2049c51fa) Auto-fix JSON comments and trailing commas for HTTP request bodies - [`f61fdea`](https://github.com/mountain-loop/yaak/commit/f61fdea48396a44f60c8a48e43b999212b0be6eb) Merge branch 'main' into json-comments - [`d1a24d2`](https://github.com/mountain-loop/yaak/commit/d1a24d2dd4e975a19af2107f59e510666860146d) Address review comments: strict JSON lint and deduplicate GraphQL GET params ### 📊 Changes **22 files changed** (+954 additions, -161 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates-cli/yaak-cli/src/plugin_events.rs` (+5 -59) 📝 `crates-tauri/yaak-app/src/lib.rs` (+3 -0) 📝 `crates-tauri/yaak-app/src/render.rs` (+2 -62) 📝 `crates-tauri/yaak-app/src/ws_ext.rs` (+5 -2) 📝 `crates/yaak-common/src/serde.rs` (+7 -0) 📝 `crates/yaak-http/Cargo.toml` (+1 -0) 📝 `crates/yaak-http/src/types.rs` (+120 -12) 📝 `crates/yaak-templates/src/format_json.rs` (+235 -6) 📝 `crates/yaak-templates/src/lib.rs` (+1 -0) ➕ `crates/yaak-templates/src/strip_json_comments.rs` (+318 -0) 📝 `crates/yaak/src/render.rs` (+59 -1) 📝 `package-lock.json` (+11 -0) 📝 `src-web/components/GrpcEditor.tsx` (+2 -2) 📝 `src-web/components/HttpRequestPane.tsx` (+4 -9) ➕ `src-web/components/JsonBodyEditor.tsx` (+122 -0) 📝 `src-web/components/core/Editor/Editor.tsx` (+5 -0) 📝 `src-web/components/core/Editor/extensions.ts` (+11 -6) 📝 `src-web/components/core/Editor/json-lint.ts` (+10 -2) 📝 `src-web/components/graphql/GraphQLEditor.tsx` (+1 -0) _...and 2 more files_ </details> ### 📄 Description You can now comment out parts of the UI (cmd+/) to enable/disable parts of your request body. This also works for WebSocket/gRPC messages, as well as the GraphQL variables editor. When the request is sent, comments will be stripped and any trailing commas will also be removed before sending. This auto-fix behavior can be disabled within the request body editor if you actually need to send literal commented-JSON to the server. <img width="1528" height="1010" alt="image" src="https://github.com/user-attachments/assets/e23a17f8-15d1-4da1-b3f8-0ab8b385a21b" /> - Add JSONC (JSON with Comments) support across all request types: HTTP, gRPC, GraphQL, and WebSocket - New `JsonBodyEditor` component with an "Automatically Fix JSON" toggle that strips comments and trailing commas before sending (enabled by default) - Configurable JSON linter that adapts based on the auto-fix setting — lenient when on, strict when off - Strip trailing commas left behind when commenting out the last JSON property - Fix JSON formatter incorrectly pulling standalone comments onto the previous line Closes https://yaak.app/feedback/posts/allow-commenting-json-body --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 19:38:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/yaak#1609