ZEROFAIL / goblin-legacy

OGM for TinkerPop3 Gremlin Server
Apache License 2.0
23 stars 8 forks source link

Added an Enum property type #24

Closed dusktreader closed 7 years ago

dusktreader commented 8 years ago

Added a type that supports a proeprty being an enum. The values that may be assigned to that property are restricted to valid members of the Enum type.

Also added some test cases

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.6%) to 72.659% when pulling 3dc064f8210bed87f11bbcf29a937d5fc60431a2 on dusktreader:tbeck/add_enum_property into 54300961d95b4732d62d76440b6657d473dd6d6c on ZEROFAIL:dev.

davebshow commented 8 years ago

@dusktreader Sorry I was a little slow getting back on this one. We are a bit concerned about this property type, as there is no way to specify the type of member objects, and this could pose a problem for property deserialization. Is there a reason that you can't use a regular property type and pass the accepted values using the choices kwarg?

dusktreader commented 8 years ago

@davebshow I hadn't noticed the 'choices' option before. I think this could work, but the syntax is a little weird. Also, I noticed that the documentation is out of date because the function is expecting a tuple of tuples or a list of lists but the docs says it should be a dict