Skip to content

Conversation

@adiom-mark
Copy link
Collaborator

@adiom-mark adiom-mark commented Dec 13, 2025

A workaround in case you need comma in payload or just cause you prefer json.

Summary by CodeRabbit

  • New Features
    • Added a new CLI flag for the /dev/fakesource connector to accept JSON payloads, allowing users to apply structured data to items with proper error handling for invalid JSON.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

A new JSON payload mechanism is added to the /dev/fakesource connector, allowing users to supply JSON payloads via a new payload-json CLI flag. This JSON input can override or merge with existing key:value payload entries, with proper error handling for invalid JSON.

Changes

Cohort / File(s) Summary
JSON Payload Support for Connectors
internal/app/options/connectorflags.go
Adds encoding/json import, introduces payload-json CLI flag for /dev/fakesource connector, and implements logic to parse and apply JSON payloads. JSON unmarshaling into the payload map with override/merge semantics and error handling for invalid JSON.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review the JSON unmarshalling logic for correctness and robustness
  • Verify override/merge behavior when both key:value and JSON payloads are provided
  • Check error handling for invalid JSON input
  • Consider edge cases such as conflicting keys or empty payloads

Poem

🐰 A clever flag hops into view,
Payload-json works like magic too—
JSON meets key:value in harmony,
Connectors now blend effortlessly! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Add payload-json to fakesource' directly and clearly describes the main change: adding a new payload-json feature to the fakesource connector.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fakesourcejson

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
internal/app/options/connectorflags.go (1)

250-253: LGTM with a minor documentation note.

The new payload-json flag is correctly defined. The actual behavior merges JSON entries with existing payload entries (with JSON keys taking precedence), which is appropriate.

Minor: Consider updating the usage text for clarity:

-					Usage: "Payload for all items as a json (overrides payload)",
+					Usage: "Payload for all items as JSON (merges with and overrides payload entries)",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a5d8c9 and 22b1879.

📒 Files selected for processing (1)
  • internal/app/options/connectorflags.go (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
internal/app/options/connectorflags.go (2)

5-5: LGTM!

The encoding/json import is correctly added and necessary for the new JSON unmarshaling functionality.


264-269: No action needed. The code is correct.

The Payload field is explicitly typed as map[string]any (line 255), which is designed to handle mixed types. Storing string values (line 262) and unmarshaling JSON objects (lines 266-268) into the same map[string]any is not a type inconsistency—it's the intended behavior. The downstream ConnV2Input and connV2 both accept map[string]any, and the implementation correctly handles all JSON types.

@adiom-mark adiom-mark merged commit 559d9d4 into main Dec 13, 2025
2 checks passed
@adiom-mark adiom-mark deleted the fakesourcejson branch December 13, 2025 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants