Skip to content
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

Parse strings into dictionaries in coerce-to-dictionary #3270

Draft
wants to merge 1 commit into
base: ucr
Choose a base branch
from

Conversation

ewpatton
Copy link
Member

Change-Id: Ib8656bb97ce9d9bfa9cdeb711b0f2425d834a8bf

General items:

If your code changes how something works on the device (i.e., it affects the companion):

  • I branched from ucr
  • My pull request has ucr as the base

Further, if you've changed the blocks language or another user-facing designer/blocks API (added a SimpleProperty, etc.):

  • I have updated the corresponding version number in YaVersion.java
  • I have updated the corresponding upgrader in YoungAndroidFormUpgrader.java (components only)
  • I have updated the corresponding entries in versioning.js

For all other changes:

  • I branched from master
  • My pull request has master as the base

What does this PR accomplish?

A common pattern is that a REST call using the Web component will return JSON, but the responseContent parameter is always a string. People naturally try to pass this into a dictionary block thinking it is a dictionary, but this errors out. This PR adjusts the logic of coerce-to-dictionary so that if it is given a string it will parse it into a dictionary. We might be able to make it more efficient if we somehow cache the result of the parsing so multiple calls don't result in multiple parsing passes, but that can be an improvement left for another time.

Change-Id: Ib8656bb97ce9d9bfa9cdeb711b0f2425d834a8bf
@ewpatton
Copy link
Member Author

Note that this is just the iOS implementation. We'll want to implement the equivalent logic on the Android side as well.

@ewpatton ewpatton added the testflight This PR is deployed via Apple TestFlight label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant