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

Data Display Object Conditional "text" fields #6

Open
JaceHensley opened this issue Jan 13, 2022 · 3 comments
Open

Data Display Object Conditional "text" fields #6

JaceHensley opened this issue Jan 13, 2022 · 3 comments
Assignees
Milestone

Comments

@JaceHensley
Copy link
Collaborator

JaceHensley commented Jan 13, 2022

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
Copy link

bumblefudge commented Oct 13, 2022

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

@brentzundel brentzundel added this to the v1 milestone Oct 27, 2022
@bumblefudge bumblefudge removed this from the v1 milestone Jan 12, 2023
@bumblefudge
Copy link

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

@andorsk
Copy link
Collaborator

andorsk commented Jan 26, 2023

#29 might address this.

@brentzundel brentzundel added this to the v2 milestone Jan 26, 2023
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

No branches or pull requests

5 participants