Skip to content

[REQ] Feature Request Description #24965

Description

@Bernardoow

Is your feature request related to a problem? Please describe.

The Python generator currently supports urllib3, asyncio, and httpx, but it does not offer HTTPX2 as a selectable HTTP client library.

I would like to generate Python clients that depend on and use HTTPX2 directly, without manually modifying the generated code or maintaining custom templates.

Describe the solution you'd like

Add httpx2 as a library option for the existing Python generator:

openapi-generator-cli generate \
  -i openapi.yaml \
  -g python \
  --library httpx2 \
  -o ./client

The implementation would:

  • Generate asynchronous clients using httpx2.AsyncClient.
  • Support optional synchronous wrappers through the existing supportHttpxSync=true option.
  • Reuse the existing HTTPX transport templates where appropriate.
  • Declare HTTPX2 dependencies and generate standards-based packaging metadata for this library.
  • Include Petstore samples, tests, documentation, and CI coverage.

Existing library options and defaults would remain unchanged.

Describe alternatives you've considered

  • Continuing to use the existing HTTPX client.
  • Maintaining custom templates through the -t option.
  • Manually replacing imports and dependencies after generation.

Custom templates and manual changes require ongoing maintenance and make regeneration less convenient. A built-in library option would provide a consistent, tested integration.

Additional context

HTTPX2 repository: https://github.com/pydantic/httpx2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions