VariantType and SecurityPolicyType should be IntEnum
dakotahorstman opened this issue · 0 comments
dakotahorstman commented
Describe the bug
Attempts to serialize an object with SecurityPolicyType or VariantType attributes fail. Enums cannot be serialized. Changing them to IntEnum makes them serializable, plus they are already effectively IntEnums based on their implementation (i.e. named_attribute = int
).
To Reproduce
import json
from asyncua.ua import VariantType, SecurityPolicyType
json.dumps({"variant": VariantType.Boolean, "security_policy": SecurityPolicyType.None})
>>> `TypeError: Object of type VariantType is not JSON serializable`
OR
>>> `TypeError: Object of type SecurityPolicyType is not JSON serializable`
Expected behavior
Serialization to succeed.
Version
Python-Version:3.12
opcua-asyncio Version (e.g. master branch, 0.9): 1.1.0