🌐
Pydantic
docs.pydantic.dev › latest › integrations › datamodel_code_generator
datamodel-code-generator - Pydantic Validation
The datamodel-code-generator project is a library and command-line utility to generate pydantic models from just about any data source, including: OpenAPI 3 (YAML/JSON) JSON Schema · JSON/YAML/CSV Data (which will be converted to JSON Schema) ...
🌐
OpenAPI Generator
openapi-generator.tech › docs › generators › python-pydantic-v1
Documentation for the python-pydantic-v1 Generator | OpenAPI Generator
December 13, 2023 - These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to configuration docs for more details
Discussions

How to generate python HTTP clients that consume OpenAPI / Pydantic / FastAPI specs
We use openapi generator you liked. You're right, the docs are sparse but it does work. They have a generator which used pydantic which is a bit better, IMO, but both are fine More on reddit.com
🌐 r/FastAPI
10
9
May 21, 2024
[PYTHON] update to pydantic v2
Description Recently, pydantic v2 was released, with changes that deprecate/remove some configs and functions. In order to keep the generator up-to-date, and avoid generating deprecated code, a tem... More on github.com
🌐 github.com
14
August 31, 2023
python - How to configure openapi-generator-cli to include examples in Pydantic models - Stack Overflow
How to configure openapi-generator-cli to include None values for nullable fields in Pydantic models More on stackoverflow.com
🌐 stackoverflow.com
openapi - Generate Open API spec from Pydantic with references to discriminators - Stack Overflow
I am trying to create a set of POJOs from an OpenAPI specification that is generated from a pydantic data model. The problem I'm hitting is with discriminators. I am currently using the following More on stackoverflow.com
🌐 stackoverflow.com
🌐
Speakeasy
speakeasy.com › openapi › frameworks › pydantic
How To Generate an OpenAPI Document With Pydantic V2 | Speakeasy
January 22, 2026 - How to generate OpenAPI documents and great SDKs for your Pydantic V2 Models
🌐
PyPI
pypi.org › project › openapi-pydantic
openapi-pydantic · PyPI
The Schema Object in OpenAPI has definitions and tweaks in JSON Schema, which are hard to comprehend and define a good data class · Pydantic already has a good way to create JSON schema.
      » pip install openapi-pydantic
    
Published   Jan 08, 2025
Version   0.5.1
🌐
GitHub
github.com › OpenAPITools › openapi-generator › blob › master › docs › generators › python-pydantic-v1.md
openapi-generator/docs/generators/python-pydantic-v1.md at master · OpenAPITools/openapi-generator
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3) - openapi-generator/docs/generators/python-pydantic-v1.md at master · ...
Author   OpenAPITools
🌐
GitHub
github.com › koxudaxi › datamodel-code-generator
GitHub - koxudaxi/datamodel-code-generator: Python data model generator (Pydantic, dataclasses, TypedDict, msgspec) from OpenAPI, JSON Schema, GraphQL, and raw data (JSON/YAML/CSV). · GitHub
Python data model generator (Pydantic, dataclasses, TypedDict, msgspec) from OpenAPI, JSON Schema, GraphQL, and raw data (JSON/YAML/CSV). - koxudaxi/datamodel-code-generator
Starred by 3.8K users
Forked by 429 users
Languages   Python
🌐
Medium
medium.com › @fberndt87 › autogenerate-pydantic-models-from-openapi-yaml-75ed38858e56
Autogenerate pydantic models from openapi.yaml | by Felix E. | Medium
November 15, 2022 - The standard workflow is that we check out their swagger documentation mostly using http://xyz.com/docs and then we write the corresponding pydantic models and necessary requests on our own. But what sounds easy is sometimes quite error-prone as we’re only human and make mistakes. Your first Idea maybe is to generate the initial data on editor.swagger.io but the outcome of that approach is a simple Python class and you need to rewrite everything to a pydantic Model and update the request functions too.
Find elsewhere
🌐
Reddit
reddit.com › r/fastapi › how to generate python http clients that consume openapi / pydantic / fastapi specs
r/FastAPI on Reddit: How to generate python HTTP clients that consume OpenAPI / Pydantic / FastAPI specs
May 21, 2024 -

I'm looking for a framework that will produce python libraries that can consume my pydantic-typed FastAPI endpoints in both sync and async contexts.

Generate Clients - FastAPI links to OpenAPI Generator, which apparently has a python generator: Documentation for the python Generator | OpenAPI Generator, but the documentation looks kind of sparse. Can someone link me to a tutorial about how to use it for FastAPI / Pydantic? Note, it also links to Speakeasy, which looks great if you work for a fortune 50 company or something; pricing is expensive.

I've also seen a few discussion threads in FastAPI about this, for example Client with the same awesomeness? · Issue #85 · tiangolo/fastapi

Does anyone know a library that can consume a swagger file and provide nice interface for interacting with the API (something similar what suds did for SOAP) ? I'm particularly after auto-generated Pydantic definitions of swagger request/response objects. I think u/dmontagu 's fastapi_client and @koxudaxi 's datamodel-code-generator ...

It looks like fastapi_client is abandonware, and datamodel-code-generator looks cool but AFAICT it's not generating a python client but some client data models. Not sure what the use case is there, if you start out using pydantic with fastapi.

🌐
GitHub
github.com › OpenAPITools › openapi-generator › issues › 16468
[PYTHON] update to pydantic v2 · Issue #16468 · OpenAPITools/openapi-generator
August 31, 2023 - Description Recently, pydantic v2 was released, with changes that deprecate/remove some configs and functions. In order to keep the generator up-to-date, and avoid generating deprecated code, a template update is in order to produce pyda...
Author   oshmoun
🌐
GitHub
github.com › samuelcolvin › pydantic-testing-openapi-generator
GitHub - samuelcolvin/pydantic-testing-openapi-generator: See https://github.com/pydantic/pydantic/discussions/4359
If you need to invoke an older version of the generator, you can define the variable OPENAPI_GENERATOR_VERSION either ad hoc or globally. You can export this variable if you'd like to persist a specific release version. ... # Execute latest released openapi-generator-cli openapi-generator-cli version # Execute version 4.1.0 for the current invocation, regardless of the latest released version OPENAPI_GENERATOR_VERSION=4.1.0 openapi-generator-cli version # Execute version 4.1.0-SNAPSHOT for the current invocation OPENAPI_GENERATOR_VERSION=4.1.0-SNAPSHOT openapi-generator-cli version # Execute v
Author   samuelcolvin
🌐
GitHub
github.com › litestar-org › pydantic-openapi-schema
GitHub - litestar-org/pydantic-openapi-schema: Generate OpenAPI 3.x.x using Pydantic
Generate OpenAPI 3.x.x using Pydantic. Contribute to litestar-org/pydantic-openapi-schema development by creating an account on GitHub.
Starred by 11 users
Forked by 4 users
Languages   Python 99.8% | Dockerfile 0.2% | Python 99.8% | Dockerfile 0.2%
🌐
GitHub
github.com › MarcoMuellner › openapi-python-generator
GitHub - MarcoMuellner/openapi-python-generator: A client generator from openapi for python.
Distributed under the terms of the MIT license, Openapi Python Generator is free and open source software. If you encounter any problems, please file an issue along with a detailed description. Special thanks to the peeps from openapi-schema-pydantic, which already did a lot of the legwork by providing a pydantic schema for the OpenAPI 3.0.0+ specification.
Starred by 93 users
Forked by 39 users
Languages   Python 95.8% | Jinja 4.2% | Python 95.8% | Jinja 4.2%
🌐
PyPI
pypi.org › project › openapi-schema-pydantic
openapi-schema-pydantic · PyPI
from openapi_schema_pydantic.v3.v3_0_3 import OpenAPI, ...
      » pip install openapi-schema-pydantic
    
Published   Jun 29, 2022
Version   1.2.4
🌐
PyPI
pypi.org › project › pydantic-openapi-helper
pydantic-openapi-helper
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
PyPI
pypi.org › project › flask-pydantic-openapi
flask-pydantic-openapi · PyPI
generate OpenAPI document and validate request & response with Python annotations.
      » pip install flask-pydantic-openapi
    
Published   Jan 31, 2023
Version   0.4.2
🌐
PyPI
pypi.org › project › apiclient-pydantic-generator
apiclient-pydantic-generator · PyPI
October 20, 2021 - This code generator creates a ApiClient app from an openapi file. ... api-client-pydantic extension for validate request data and converting json straight to pydantic class.
      » pip install apiclient-pydantic-generator
    
Published   Oct 20, 2021
Version   0.1.0