OpenAPITools / OpenAPITools/openapi-generator

[REQ] Support pydantic v2 in python-fastapi generator

Open
#17,703 4 comments 2 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-fastapi generator constructs models with pydantic v1.

Describe the solution you'd like

It would be nice to have an option to use pydantic v2, such as discussed in this comment.

Describe alternatives you've considered

I've considered using the python generator but it doesn't match my use-case as seemlessly as the python-fastapi generator.

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

Read the python-fastapi generator and the linked discussion in PR 16549 first. Define how the requested option should affect generated models, then verify that pydantic v2 output works while the existing pydantic v1 path remains available.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.