Search code examples
pythonenumsdatabase-schemaeve

Enum type in python eve schema


I am an amateur in the python Eve framework, but I am using it for development purpose. However, I don't know how to have a enum type in the schema. I mean the syntax in python Eve for this data type.

So, how do I express this in python eve schema?

"tts" : {"enum": ["show","hide"]},

Any help is appreciated.


Solution

  • You're looking for the allowed rule.

    "tts" : {"type": "string", "allowed": ["show", "hide"]}