I have a
myenum(str, Enum):
COLORRED = 'colorred'
COLORBLUE = 'colorblue'
itemList = [<myenum.COLORRED,'colorred'>]
I am trying to get value from itemList 'coloured' but itemList.value
gives a type check error in Python with the error message "str has no attribute value".
list(map(str,myenum)) gives key COLORRED but I need the value 'coloured'. I tried String-based enum in Python but none of them are working for me.
My enum is auto generated by openapi. below is yaml for it. I receive array of myElements and need one value in myEnum.
myElements:
type: array
items:
allOf:
- $ref: 'myEnum'
myEnum:
type: String
enum:
- 'state1'
- 'state2'
Note: Issue is with typecheck in python not iterating the values. I need enum values without using .values or .name