decentralized-identity / wallet-rendering

Specifications for rendering DID and Credential-centric data in wallet applications
https://identity.foundation/wallet-rendering
Apache License 2.0
8 stars 2 forks source link

Data Display Object Conditional "text" fields #6

Open JaceHensley opened 2 years ago

JaceHensley commented 2 years ago

Sometimes what's in the JSON isn't meant to be human readable and instead of showing that to the user you'd want to show a human readable value based on the value in the JSON. Given the JSON:

{
  "status": "no_match"
}

you'd want to display to the user:

Status: No Match

the logic we'd want to represent in the Display Object to be:

if (status === "no_match") {
  return "No Match"
} else if (status === "match") {
  return "Match"
}

One idea is to allow "text" to be a string or array of objects that look like this:

{
  "text": [
    {
      "path": [""], // path(s) of property to test
      "schema": {
        // JSON Schema to test the path
      },
      "text": ""
    }
  ]
}

"text" would be an ordered array where the last item could optionally just contain "text" as a fallback/else

bumblefudge commented 2 years ago

Maybe revisit when considering localization? could be an optional extension that shares much of the same layering/processing model...

bumblefudge commented 1 year ago

Is this use-case specific to architectures or divisions of labor not expressed in this issue?

andorsk commented 1 year ago

29 might address this.