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
raiseTypeError(f"received an unexpected openapi type: {schema.type}") # pragma: no cover
MCVE
Uselitestarfullstack.
Steps to reproduce
git clone https://github.com/litestar-org/litestar-fullstack.git
cd litestar-fullstack
make install
source .venv/bin/activate
app schema typescript
Screenshots
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
Logs
Traceback (most recent call last):
File ".venv/bin/app", line 8, in<module>sys.exit(run_cli())
^^^^^^^^^
File "src/app/__main__.py", line 25, in run_cli
run_litestar_cli()
File ".venv/lib/python3.12/site-packages/litestar/__main__.py", line 6, in run_cli
litestar_group()
File ".venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/rich_click/rich_command.py", line 126, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
returnf(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/cli/_utils.py", line 273, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
returnf(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/cli/_utils.py", line 273, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/cli/commands/schema.py", line 75, in generate_typescript_specs
specs = convert_openapi_to_typescript(app.openapi_schema, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/converter.py", line 299, in convert_openapi_to_typescript
responses = parse_responses(operation.responses or {}, components=openapi_schema.components)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/converter.py", line 228, in parse_responses
ts_type = parse_schema(content[0])
^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/schema_parsing.py", line 146, in parse_schema
return TypeScriptArray(parse_schema(schema.items))
^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/schema_parsing.py", line 148, in parse_schema
return create_interface(
^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/schema_parsing.py", line 95, in create_interface
parsed_properties = tuple(
^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/schema_parsing.py", line 98, in<genexpr>
value=parse_schema(schema),
^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/schema_parsing.py", line 152, in parse_schema
return parse_type_schema(schema=schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/litestar/_openapi/typescript_converter/schema_parsing.py", line 129, in parse_type_schema
raise TypeError(f"received an unexpected openapi type: {schema.type}") # pragma: no cover
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: received an unexpected openapi type: None
Description
Generating typescript from openapi schema results in an Error:
TypeError: received an unexpected openapi type: None
I think this is due to the Response Object "400" contains "null", but I didn't went into the schema generation rabbit hole.
URL to code causing the issue
litestar/litestar/_openapi/typescript_converter/schema_parsing.py
Line 127 in b38f530
MCVE
Steps to reproduce
Screenshots
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
Logs
Litestar Version
2.7.1
Platform
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: