Closed mikepc closed 4 years ago
scope = fields.StringField(required=True,
validators=[
validators.Enum([s.value for s in Scope ])
])
When I assign the value of scope = Scope.ALL.value (this == 'all') the validation is failing with:
"Value 'all' is not a valid choice."
scope = fields.StringField(required=True,
validators=[
validators.Enum(*[s.value for s in Scope ])
])
Fixed by de-referencing the array into an arg list.
Hey there! Does anyone have an example of using an enum for a field?
I see that there was validation added for enums, but how do I go about defining the field on the model?