Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

fastapi-code-generator

> 后端框架
Open source

This code generator creates FastAPI app from an openapi file.

1.4K stars0 likes0 views
WebsiteGitHub

About

This code generator creates FastAPI app from an openapi file.

fastapi-code-generator

Generate a FastAPI application from an OpenAPI document.

Maintainer update: Open to opportunities. koxudaxi.dev

Documentation

The docs site is the source of truth for user-facing documentation:

  • Overview
  • CLI Reference
  • Supported Formats
  • Development & Contributing

Use this README as a quick start. The full examples, templating details, and development workflow live in docs/.

Installation

bash
uv tool install fastapi-code-generator
bash
pip install fastapi-code-generator

Quick Start

bash
fastapi-codegen --input openapi.yaml --output app --output-model-type pydantic_v2.BaseModel

fastapi-code-generator uses datamodel-code-generator to build the model layer. See the overview guide for a complete end-to-end example, custom templates, custom visitors, and router generation.

Command Help Snapshot

This block is generated from the current CLI so the README and docs overview stay aligned. For tested option scenarios and examples, use the CLI reference page.

…

Common Tasks

  • Generate a single-file app from an OpenAPI spec: fastapi-codegen --input openapi.yaml --output app
  • Generate router modules for larger applications: fastapi-codegen --input openapi.yaml --output app --template-dir modular_template --generate-routers
  • Limit router regeneration to specific tags: fastapi-codegen --input openapi.yaml --output app --template-dir modular_template --generate-routers --specify-tags "Wild Boars, Fat Cats"
  • Target Pydantic v2 output: fastapi-codegen --input openapi.yaml --output app --output-model-type pydantic_v2.BaseModel

Further Reading

  • Overview for the full walkthrough and generated output example
  • CLI Reference for option-by-option behavior and tested scenarios
  • Supported Formats for the generated support matrix
  • Development & Contributing for the local workflow and docs maintenance steps

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Pythonfastapigeneratoropenapipydantic

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架