decentralized-identity / decentralized-identity/wallet-rendering

Data Display Object Conditional "text" fields

Open
#6 3 comments 0 reactions 1 assignee Claimed by @nklomp View on GitHub
Dominant language
JavaScript
Stars
8
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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:

```json5
{
"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:

```js
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:

```json5
{
"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`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.