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
  • #2991
Closed
Open
Issue created May 24, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][Python] ModuleNotFoundError when packagename contains dots

Created by: saigiridhar21

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

If we have dots in the packagename (e.g., openapi.client), then required directory structure is getting created like openapi/client. Inside openapi/client/, we will have api and models directories. But, __init__.py files are missing from those sub directories(at openapi and client level). So, the users of this built package will face ModuleNotFoundError: No module named 'openapi' error.

openapi-generator version

4.0.0

OpenAPI declaration file content or url
Command line used for generation

java -jar openapi-generator-cli.jar generate --generator-name python --input-spec openapi-schema.json --output openapi.client --additional-properties packagename=openapi.client

Steps to reproduce
  • Generate the SDK using a package name that contains dots e.g., openapi.client.
  • Then, build and install the SDK.
  • Try to import it in a separate project as a client/user of SDK and run some example code.
  • Then, an error will thrown like ModuleNotFoundError: No module named 'openapi'
Related issues/PRs
Suggest a fix

If the packagename contain dots, add __init__.py files at each sub directory level.

Assignee
Assign to
Time tracking