class Status(ConstantStr, enum.Enum):
ON = "on"
OFF = "off"
class Robot(Predicate):
name: str
status: Status
Because of a wrong priority (order) when trying to infer (create) the correct Field, Robot.status was handled as a ConstantField instead of a custom Field which restricts the allowed values. The result was that you could create a Robot-fact with status f.i. "standby"
This PR fixes that problem by first handling the case if the type of Status is an Enum and handle the case for a ConstantStr afterwards
Let's consider the following situation
Because of a wrong priority (order) when trying to infer (create) the correct Field,
Robot.status
was handled as aConstantField
instead of a customField
which restricts the allowed values. The result was that you could create a Robot-fact with status f.i. "standby"This PR fixes that problem by first handling the case if the type of
Status
is an Enum and handle the case for aConstantStr
afterwards