[Question] Get value of key of type Enum as string?
See original GitHub issueGetting the value of a key of type Enum as string feels not intuitive for me. Am I doing it correctly?
from strictyaml import Map, Enum, load, YAML
yaml_snippet = """
a: A
"""
schema = Map({"a": Enum(["A", "B", "C"])})
parsed = load(yaml_snippet, schema)
# parsed is YAML(OrderedDict([('a', YAML(A))]))
# parsed['a'].value is YAML(A)
# parsed['a'].value.value is 'A'
# parsed['a'].data.data is 'A'
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How to get names of enum entries? - typescript - Stack Overflow
In JS enum is an object of [value]: name so you can get all values like that Object.keys(enum) , all names Object.values(enum) and...
Read more >Typescript enum get key by value, value by key, use as object ...
Explains how to get value by key, get key by value, and use an enum as an object key. Some functions don't behave...
Read more >TypeScript Enums—Look up the name (key) of a string-based ...
We can look up an enums member name (key) given its number (value) like this: Enums support accessing data in both directions from...
Read more >Top 8 functions you'll ever need to work with Enums in ...
1. Check if a key is property of enum · 2. Check if enum has a given value · 3. Transform enum to...
Read more >Getting enum keys in TypeScript - Crojach Software
While working on a task, my colleague stumbled upon a quirky problem. He tried to fetch all keys out of an enum but...
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 Free
Top 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
Thx a lot. It’s working just fine now!
Ok fixed in 0.15.3, released just a second ago.