Cast tokens to other types -

Created on 8 May 2024, 8 months ago
Updated 18 May 2024, 7 months ago

Problem/Motivation

With πŸ“Œ Implement Token Replacements Needs work support for tokens as a default value becomes supported, but only with properties that have a "string" type -- there is no attempt to cast the value to other types. This leads to an error when adding a token to a non-string type - e.g. numeric. Moreover, rendering a field that contains an integer to pass it to a component (without using tokens) will yield "3" and not 3 as we want

Steps to reproduce

  1. Associate an SDC with a numeric type to a content type.
  2. Add a token for a numeric field to the SDC prop
  3. Get error.

Proposed resolution

Add support for casting the token value to:

  • boolean
  • integer
  • number
  • null

Array and Object types may be considered later, this issue is only to handle casting to other scalar types.

Remaining tasks

Create.

User interface changes

None needed.

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @freelock
  • e0ipso Can Picafort

    This may also be true for field mappings correct? I mean, rendering a field that contains an integer to pass it to a component will yield "3" and not 3 as we want.

    Updating the Issue Summary to reflect this.

Production build 0.71.5 2024