[PR #297] [MERGED] Add an option to allow jsonpath/xpath to return as array #218

Closed
opened 2025-12-29 08:32:08 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/297
Author: @majcn
Created: 11/12/2025
Status: Merged
Merged: 11/13/2025
Merged by: @gschier

Base: mainHead: fix/json_path_array


📝 Commits (5)

  • fab1430 Add an option to allow json/xpath to return as array
  • a5831d3 Merge branch 'refs/heads/main' into fork/majcn/fix/json_path_array
  • fbc0a0b Merge branch 'main' into fix/json_path_array
  • c278310 Merge remote-tracking branch 'majcn/fix/json_path_array' into fork/majcn/fix/json_path_array
  • 092b67a Switch to select and refactor/improve a bunch of the plugin system

📊 Changes

34 files changed (+797 additions, -335 deletions)

View changed files

📝 package-lock.json (+1 -6)
📝 packages/plugin-runtime-types/src/bindings/gen_events.ts (+4 -2)
📝 packages/plugin-runtime-types/src/plugins/AuthenticationPlugin.ts (+21 -6)
📝 packages/plugin-runtime-types/src/plugins/TemplateFunctionPlugin.ts (+23 -13)
📝 packages/plugin-runtime-types/src/plugins/index.ts (+5 -2)
📝 packages/plugin-runtime/src/PluginInstance.ts (+17 -44)
packages/plugin-runtime/src/common.ts (+56 -0)
📝 packages/plugin-runtime/src/migrations.ts (+2 -5)
packages/plugin-runtime/tests/common.test.ts (+150 -0)
📝 plugins/auth-aws/src/index.ts (+1 -9)
📝 plugins/auth-oauth2/src/index.ts (+2 -0)
📝 plugins/template-function-fs/src/index.ts (+4 -4)
📝 plugins/template-function-json/package.json (+1 -0)
📝 plugins/template-function-json/src/index.ts (+88 -18)
📝 plugins/template-function-response/package.json (+1 -6)
📝 plugins/template-function-response/src/index.ts (+118 -65)
📝 plugins/template-function-xml/package.json (+1 -0)
📝 plugins/template-function-xml/src/index.ts (+56 -10)
📝 src-tauri/src/plugin_events.rs (+1 -1)
📝 src-tauri/yaak-models/src/db_context.rs (+3 -3)

...and 14 more files

📄 Description

In case like this:

[
  {"name": "111"},
  {"name": "222"}
]

if you put $..name it only returned first value: "111"

I understand why this behavior is expected since JsonPath is always returning array, that's why I added new checkbox to force return as array

The other option I was considering was to just simply check if array length is > 1, but this can be a bit misleading when only a single value is returned in results like $..name


🔄 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/297 **Author:** [@majcn](https://github.com/majcn) **Created:** 11/12/2025 **Status:** ✅ Merged **Merged:** 11/13/2025 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `fix/json_path_array` --- ### 📝 Commits (5) - [`fab1430`](https://github.com/mountain-loop/yaak/commit/fab1430c075e327b31a9f238d3248f8ecf165782) Add an option to allow json/xpath to return as array - [`a5831d3`](https://github.com/mountain-loop/yaak/commit/a5831d30e0ac24475bbd54f5c89bdbd6af8d014c) Merge branch 'refs/heads/main' into fork/majcn/fix/json_path_array - [`fbc0a0b`](https://github.com/mountain-loop/yaak/commit/fbc0a0b896cbc1a4410f46d9ee35b84dcd23defa) Merge branch 'main' into fix/json_path_array - [`c278310`](https://github.com/mountain-loop/yaak/commit/c2783108f2b574bc3f5643d4463e32cc97ca5776) Merge remote-tracking branch 'majcn/fix/json_path_array' into fork/majcn/fix/json_path_array - [`092b67a`](https://github.com/mountain-loop/yaak/commit/092b67a731209a969f8ef87fba973b1ffac3bf73) Switch to select and refactor/improve a bunch of the plugin system ### 📊 Changes **34 files changed** (+797 additions, -335 deletions) <details> <summary>View changed files</summary> 📝 `package-lock.json` (+1 -6) 📝 `packages/plugin-runtime-types/src/bindings/gen_events.ts` (+4 -2) 📝 `packages/plugin-runtime-types/src/plugins/AuthenticationPlugin.ts` (+21 -6) 📝 `packages/plugin-runtime-types/src/plugins/TemplateFunctionPlugin.ts` (+23 -13) 📝 `packages/plugin-runtime-types/src/plugins/index.ts` (+5 -2) 📝 `packages/plugin-runtime/src/PluginInstance.ts` (+17 -44) ➕ `packages/plugin-runtime/src/common.ts` (+56 -0) 📝 `packages/plugin-runtime/src/migrations.ts` (+2 -5) ➕ `packages/plugin-runtime/tests/common.test.ts` (+150 -0) 📝 `plugins/auth-aws/src/index.ts` (+1 -9) 📝 `plugins/auth-oauth2/src/index.ts` (+2 -0) 📝 `plugins/template-function-fs/src/index.ts` (+4 -4) 📝 `plugins/template-function-json/package.json` (+1 -0) 📝 `plugins/template-function-json/src/index.ts` (+88 -18) 📝 `plugins/template-function-response/package.json` (+1 -6) 📝 `plugins/template-function-response/src/index.ts` (+118 -65) 📝 `plugins/template-function-xml/package.json` (+1 -0) 📝 `plugins/template-function-xml/src/index.ts` (+56 -10) 📝 `src-tauri/src/plugin_events.rs` (+1 -1) 📝 `src-tauri/yaak-models/src/db_context.rs` (+3 -3) _...and 14 more files_ </details> ### 📄 Description In case like this: ```json [ {"name": "111"}, {"name": "222"} ] ``` if you put `$..name` it only returned first value: "111" I understand why this behavior is expected since JsonPath is always returning array, that's why I added new checkbox to force return as array The other option I was considering was to just simply check if array length is > 1, but this can be a bit misleading when only a single value is returned in results like `$..name` --- <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 08:32:08 +01:00
adam closed this issue 2025-12-29 08:32:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/yaak-mountain-loop#218