OpenAPITools / OpenAPITools/openapi-generator

[REQ] Feature Request Description

Open
#24,965 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Python generator's existing urllib3, asyncio, and httpx library implementations and their HTTPX transport templates. Add the httpx2 option with AsyncClient generation, supportHttpxSync behavior, dependencies, packaging metadata, Petstore samples, tests, documentation, and CI coverage; done means generated clients use HTTPX2 without manual template changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.