Enum's title + values
See original GitHub issueIt would be awesome if we could specify enum’s with a title and value attribute. So basically instead of having:
enum: [ "value1", "value2"]
which aren’t saying anything because they are the values, it would be nice if we could specify it like this:
enum: [ {"title": "Foo", "value": "value1"}, {"title": "Bar", "value": "value2"} ]
This way you will get a dropdown or another element where you will see Foo and Bar as selectables but their values underwater would be value1 and value2
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Attaching Values to Java Enum - Baeldung
Java provides a valueOf(String) method for all enum types. Thus, we can always get an enum value based on the declared name: assertSame(Element....
Read more >Java getting the Enum name given the Enum Value
I am using a lot of nameOf(String name) , now for each I will write a *Enum.values().stream().filter(...).findAny().get() , which is so annoying. –...
Read more >enum — Support for enumerations — Python 3.11.1 ...
The enum members have names and values (the name of Color. ... Enum class decorator that ensures only one name is bound to...
Read more >Java.lang.Enum.name() Method - Tutorialspoint
Description. The java.lang.Enum.name() method returns the name of this enum constant, exactly as declared in its enum declaration.
Read more >Enum (Java Platform SE 7 ) - Oracle Help Center
Returns the name of this enum constant, exactly as declared in its enum declaration. Most programmers should use the toString() method in preference...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would prefer to not touch the
enum
property since I want to maintain compatibility with JSON Schema as much as possible. Your proposed syntax would fail to validate since the value is not strictly equal to one of the enumerated objects.This feature is already implemented using options for the
enum
editor (used for objects and arrays), but not theselect
editor (used for strings). I can add this to theselect
editor too. I’ll also probably merge these two editors in the near future since there’s not much difference between them.The syntax will be:
After view your workaround, not show a single select2 (allowing multiple selections)…