[BUG] [PYTHON] Malformed type hints on 6.3.0-SNAPSHOT with 303 status response
Created by: syntaxaire
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Clients are generated with syntax errors using the spec provided.
Sample of code with syntax errors:
class ThingDownload(BaseApi):
# this class is used by api classes that refer to endpoints with operationId fn names
@typing.overload
def thing_download(
self,
path_params: RequestPathParams = frozendict.frozendict(),
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
]: ...
It is not valid for this typing.Union
to be empty, as shown at import time:
E ) -> typing.Union[
E ^
E SyntaxError: expected ':'
openapi-generator version
openapi-generator-cli 6.3.0-SNAPSHOT
commit : 188c39d
built : 2022-11-11T16:58:19-05:00
source : https://github.com/openapitools/openapi-generator
docs : https://openapi-generator.tech/
OpenAPI declaration file content or url
Gist: https://gist.github.com/syntaxaire/9e584c63ac4ce71c7eda882a4d6837dc
Generation Details
java -jar openapi-generator-cli.jar generate --global-property skipFormModel=false -i empty-union.json -g python -o empty-union
Steps to reproduce
- Download the spec from the provided gist.
- Use the latest git version with the command line above to generate the client
- Install the client and run its unit tests, the above syntax error will be shown when imported