fix enum support in oneof/anyof in python-nextgen (#15340)

This commit is contained in:
William Cheng
2023-04-29 13:50:47 +08:00
committed by GitHub
parent e07069731d
commit 1f4d323020
59 changed files with 1436 additions and 62 deletions

View File

@@ -13,7 +13,7 @@
"""
from inspect import getfullargspec
import json
import pprint
import re # noqa: F401
from aenum import Enum, no_arg
@@ -34,3 +34,9 @@ class StringEnumRef(str, Enum):
FAILURE = 'failure'
UNCLASSIFIED = 'unclassified'
@classmethod
def from_json(cls, json_str: str) -> StringEnumRef:
"""Create an instance of StringEnumRef from a JSON string"""
return StringEnumRef(json.loads(json_str))