-
Notifications
You must be signed in to change notification settings - Fork 96
fix(designer-ui): Fix dictionary serialization with compound token expressions #8730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…pressions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
✅ Risk Level
✅ What & Why
✅ Impact of Change
✅ Test Plan
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | No change needed. |
| Commit Type | ✅ | No change needed. |
| Risk Level | ✅ | Label matches PR body, but see advised risk note below. |
| What & Why | ✅ | No change needed. |
| Impact of Change | ✅ | No change needed. |
| Test Plan | ✅ | Unit tests present and relevant. |
| Contributors | Add acknowledgements if applicable. | |
| Screenshots/Videos | ✅ | Not applicable. |
Advised risk comparison and final notes
- Advised risk level (reviewer): low — reasoning: the code change is small and targeted (a short conditional in convertValueType), limited to designer-ui utils, and supported by unit tests that were added. The diff shows 2 files changed, focused logic change with unit tests added.
- PR-assigned risk level: medium (label
risk:medium). - Actionable suggestion: If your team agrees with this assessment, consider updating the PR label to
risk:low. If there are broader concerns (backwards-compatibility with unexpected callers, cross-repo impacts), keeprisk:mediumand call out the areas of concern.
Final decision: This PR passes the PR title and body checks. Please consider adding contributor acknowledgements (if relevant) and optionally updating the risk label to risk:low if aligned with your team's risk policy. Thank you for the thorough description and for adding unit tests — this made review straightforward.
Last updated: Sun, 25 Jan 2026 17:31:36 GMT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where dictionary parameters with compound token expressions (e.g., @{variables('year')}-@{variables('month')}-@{variables('date')}) were incorrectly serialized as string literals instead of proper JSON objects, causing runtime failures.
Changes:
- Modified
convertValueTypefunction to detect compound token expressions (multiple segments with tokens) and treat them as string type for proper JSON quoting - Added comprehensive unit tests covering the fix and related edge cases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts |
Added 4-line check to treat compound expressions (tokens mixed with other content) as string type to ensure proper JSON serialization with quotes |
libs/designer-ui/src/lib/editor/base/utils/__test__/keyvalueitem.spec.ts |
New test file with comprehensive coverage testing convertValueType and convertKeyValueItemToSegments functions, validating the fix for compound expressions, single tokens, literals, and empty cases |
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
Commit Type
Risk Level
What & Why
Problem
When using dictionary parameters (like SQL's
setColumns) with compound token expressions (e.g.,@{variables('year')}-@{variables('month')}-@{variables('date')}), the UI serializes the value incorrectly as a JSON string instead of a proper JSON object.Expected output:
Actual (broken) output:
The entire dictionary is serialized as a string literal instead of a JSON object, causing runtime failures.
Root Cause
The
convertValueTypefunction inkeyvalueitem.tsdetermines whether values should be quoted in JSON. When a value contains tokens (containsTokenSegmentsreturns true), the function returns the original type (e.g.,any) instead ofstring. This causesinsertQutationForStringTypeto not add quotes around compound expressions like@{var1}-@{var2}.Without quotes, the generated JSON is invalid because compound expressions with embedded tokens cannot be valid JSON values on their own.
Fix Options Analyzed
Option 1: Fix in
parameterValueToJSONString(Not chosen)libs/designer/src/lib/core/utils/parameters/helper.tsOption 2: Fix in
convertKeyValueItemToSegments/convertValueType(Chosen)libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.tsOption 3: Fix in
getJSONValueFromString(Not chosen)libs/designer/src/lib/core/utils/parameters/helper.tsSolution
Added a check in
convertValueType: if a value contains tokens mixed with other content (i.e., compound expressions like@{var1}-@{var2}), treat it as a string type. This ensuresinsertQutationForStringTypeadds the necessary quotes around compound expressions to produce valid JSON.Impact of Change
Test Plan
Contributors
Screenshots/Videos