Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #14009
Closed
Open
Issue created Nov 14, 2022 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[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
Assignee
Assign to
Time tracking