Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json_output_decorator fails on enums #132

Open
Aspect26 opened this issue Oct 26, 2021 · 0 comments
Open

json_output_decorator fails on enums #132

Aspect26 opened this issue Oct 26, 2021 · 0 comments

Comments

@Aspect26
Copy link
Member

When json_output_decorator receives a model, which contains enum values, it is unable to serialize it to json and crashes with Circular reference detected

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/zsl/application/modules/cli_module.py", line 44, in task
    result = exec_task(task_path, data)
  File "/usr/local/lib/python3.8/site-packages/zsl/interface/task.py", line 137, in exec_task
    return jc.task_callable(jc.task_data)
  File "/usr/local/lib/python3.8/site-packages/zsl/task/task_decorator.py", line 98, in json_input_decorator
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/zsl/task/task_decorator.py", line 122, in json_output_decorator
    rv = json.dumps(rv, cls=AppModelJSONEncoder, indent=indent)
  File "/usr/local/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/usr/local/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
ValueError: Circular reference detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant