Skip to content

fix(swift): resolve only top-level path and call objects as bindings - #2326

Open
andrewkolos wants to merge 1 commit into
a2ui-project:mainfrom
andrewkolos:swift-nonrecursive-dynamic-values
Open

fix(swift): resolve only top-level path and call objects as bindings#2326
andrewkolos wants to merge 1 commit into
a2ui-project:mainfrom
andrewkolos:swift-nonrecursive-dynamic-values

Conversation

@andrewkolos

@andrewkolos andrewkolos commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

DataContext.resolveDynamicValue recursed into every plain object and array, treating any nested "path" or "call" key as a binding. Two consequences for legal payloads:

  • Inside a function-call argument (the one place the schema admits literal objects), an object that merely contains a "path" string key was rewritten by a data-model lookup: {"icon": {"path": "M12 2L2 7"}} resolved to {"icon": null}. Elements of literal arrays got the same treatment everywhere arrays are legal.
  • A nested "call" key executed its catalog function during value resolution, so a function embedded in a literal ran on every tree rebuild, meaning on every data update, rather than when something invoked it.

resolveDynamicValue now treats only a top-level "path" or "call" object as a binding and passes every other value through unchanged. This is compliant with the schema, which restricts values to single DynamicValue types and "prevents arbitrary nesting."

Pre-launch Checklist

One time:

For this PR:

  • I have updated the relevant CHANGELOG.md file.
  • I updated/added relevant documentation.
  • My code changes (if any) have tests.
  • If my branch is on a fork, I have verified that scripts/e2e_test.sh passes.

If you need help, consider asking for advice on the discussion board.

resolveDynamicValue recursed into every plain object and array, so a
literal value that merely contained a nested path key was rewritten to
a data lookup (usually null) and a nested call key executed its
function during value resolution. The TS core resolves only single
DynamicValue objects, matching the schema rule that prevents arbitrary
nesting; the Swift resolver now does the same, and non-binding
containers pass through unchanged.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request simplifies the resolveDynamicValue function in DataContext.swift by removing recursive resolution for nested dictionaries and arrays. Now, only top-level path or call objects are treated as bindings, while other containers pass through unchanged. The unused OrderedCollections import was removed, and the unit tests were updated to verify this pass-through behavior. I have no feedback to provide.

@andrewkolos
andrewkolos requested a review from pinieb August 18, 2026 17:54
@andrewkolos
andrewkolos marked this pull request as ready for review August 18, 2026 17:54
@andrewkolos
andrewkolos enabled auto-merge (squash) August 18, 2026 19:01
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