Skip to content

Upgrade to the latest OpenAPI generator #293

@tomplus

Description

@tomplus

I've tried to use the latest version of OpenAPI generator to generate the library. That version uses Pydantic2 to generate models. Unfortunately kubernetes library contains ~600 models/api and loading time (at startup) is huge and not acceptable, especially for scripts, long running applications import modules once so it's not so painful. I tried to replace imports with lazy imports as a workaround but it's still 10 time worse in compare with current version using old generator.

My tests:

  1. kubectl, local cluster (as a reference), get pods (9) from all namespaces - 0.12 sec
  2. this library, current version, example1.py to list pods - 0.50 sec
  3. OpenAPIGenerator v 7.0.1, example1.py - 17.26 sec
  4. OpenAPIGenerator like above with some lazy imports (for models, apis) - 5.22 sec

The problem is known and may be resolved in the future: pydantic/pydantic#6748

For now I' m going to switch to the version just before Pydantic. It helps to resolve some pending issues, and this issue is for tracking ideas or attempts for future upgrades.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions