[PR #111] [MERGED] Preserve invalid GraphQL variables #48

Closed
opened 2025-12-29 07:19:04 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/111
Author: @gschier
Created: 9/25/2024
Status: Merged
Merged: 9/25/2024
Merged by: @gschier

Base: masterHead: preserve-invalid-graphql-variables


📝 Commits (3)

📊 Changes

3 files changed (+57 additions, -62 deletions)

View changed files

📝 src-tauri/src/http_request.rs (+17 -2)
📝 src-web/components/GraphQLEditor.tsx (+38 -58)
📝 src-web/components/RequestPane.tsx (+2 -2)

📄 Description

This PR changes to GraphQL body type to use a custom format, instead of serializing to text: ".." on every keystroke.

This change is so we can preserve invalid JSON in the variables editor. Some people may want to make some changes, switch requests, then switch back and continue editing. The current requirement to parse variables as valid JSON prevents the editor from saving and throws away changes when navigating away. It's also very possible that someone might want to actually send invalid JSON to test a GraphQL endpoint. This PR makes that happen.

  • Change HttpRequest.body from {text: String} to {variables: Records<string, string>, query: string}
  • Update <GraphQLEditor/> to use the new format
  • Migrate text property to new format within <GraphQLEditor/>
    • Note: also allows converting JSON->GraphQL body type

Fixes #103


🔄 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/111 **Author:** [@gschier](https://github.com/gschier) **Created:** 9/25/2024 **Status:** ✅ Merged **Merged:** 9/25/2024 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `master` ← **Head:** `preserve-invalid-graphql-variables` --- ### 📝 Commits (3) - [`cffb4a9`](https://github.com/mountain-loop/yaak/commit/cffb4a9af010d08af55e252ddc766232eb4688fc) Preserve invalid GraphQL variables (Fixes #103) - [`81df6e5`](https://github.com/mountain-loop/yaak/commit/81df6e5acd0a33f11715c4e92b1352655520d3e9) Migrate text to GraphQL - [`7a24740`](https://github.com/mountain-loop/yaak/commit/7a2474011432b5d69ac7a373f16956426b32c193) Small tweak ### 📊 Changes **3 files changed** (+57 additions, -62 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/http_request.rs` (+17 -2) 📝 `src-web/components/GraphQLEditor.tsx` (+38 -58) 📝 `src-web/components/RequestPane.tsx` (+2 -2) </details> ### 📄 Description This PR changes to GraphQL body type to use a custom format, instead of serializing to `text: ".."` on every keystroke. This change is so we can preserve invalid JSON in the variables editor. Some people may want to make some changes, switch requests, then switch back and continue editing. The current requirement to parse variables as valid JSON prevents the editor from saving and throws away changes when navigating away. It's also very possible that someone might want to actually send invalid JSON to test a GraphQL endpoint. This PR makes that happen. - Change `HttpRequest.body` from `{text: String}` to `{variables: Records<string, string>, query: string}` - Update `<GraphQLEditor/>` to use the new format - Migrate `text` property to new format within `<GraphQLEditor/>` - Note: also allows converting JSON->GraphQL body type Fixes #103 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 07:19:04 +01:00
adam closed this issue 2025-12-29 07:19:04 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/yaak#48