You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using HttpUrl (or, I suspect, any *Url class) for a schema used in a response results in json serialization error. This is the same type of issue as #717.
Traceback (most recent call last):
File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/operation.py", line 121, in runreturnself._result_to_response(request, result, temporal_response)
File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/operation.py", line 278, in _result_to_responsereturnself.api.create_response(
File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/main.py", line 453, in create_response
content =self.renderer.render(request, data, response_status=status)
File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/renderers.py", line 25, in renderreturn json.dumps(data, cls=self.encoder_class, **self.json_dumps_params)
File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps**kw).encode(obj)
File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
chunks =self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencodereturn _iterencode(o, 0)
File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/responses.py", line 28, in defaultreturnsuper().default(o)
File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/django/core/serializers/json.py", line 106, in defaultreturnsuper().default(o)
File "/usr/lib/python3.10/json/encoder.py", line 179, in defaultraiseTypeError(f'Object of type {o.__class__.__name__}'TypeError: Object of type Url is not JSON serializable
The text was updated successfully, but these errors were encountered:
grigi
linked a pull request
Dec 2, 2024
that will
close
this issue
Describe the bug
django-ninja = "^1.3.0"
Using
HttpUrl
(or, I suspect, any *Url class) for a schema used in a response results in json serialization error. This is the same type of issue as #717.The text was updated successfully, but these errors were encountered: