TypeSpec is a Microsoft-developed API definition language that uses TypeScript-like syntax while generating OpenAPI Specification. The freee billing team successfully migrated their largest internal API definition — a 33,000-line OpenAPI YAML file — to TypeSpec. This case study highlights significant improvements in readability and maintainability for schema-driven development.
📑Table of Contents
- What is TypeSpec — Features of Microsoft’s API Definition Language
- Background of the Migration — Challenges with 33,000 Lines of OpenAPI YAML
- Migration Decision Points — Comparing Continued OpenAPI vs TypeSpec Adoption
- Actual Migration Steps and Development Flow
- Effects After Introduction and Remaining Challenges
- freee’s TypeSpec Usage Examples and Recommended Points
What is TypeSpec — Features of Microsoft’s API Definition Language
TypeSpec allows developers to describe API schemas in a more human-readable format. Key features include:
- TS-like syntax: Familiar to TypeScript developers for concise model and operation definitions
- OpenAPI output: Generates standard OpenAPI YAML/JSON, ensuring compatibility with existing toolchains
- Built-in Linter/Formatter: Maintains code quality automatically
- Code generation support: Works seamlessly with generators like ogen (Go) and orval (React)
The spend management team at freee has used TypeSpec for over 1.5 years (as of June 2025), defining more than 300 APIs. The billing team leveraged this experience for their full migration.
Source: freee Developers Hub – TypeSpec Migration (as of June 2026)
Background of the Migration — Challenges with 33,000 Lines of OpenAPI YAML
The freee billing team’s internal API definitions had grown to over 33,000 lines of OpenAPI YAML. Direct YAML authoring presented several challenges:
- Redundancy: Repeated schema definitions bloated the files
- Poor readability: Deep nesting made reviews and maintenance difficult
- High maintenance cost: Small changes required edits across many locations
While GraphQL migration was considered, the divergence from existing API structures made it impractical. TypeSpec’s ability to output OpenAPI as an intermediate format was the deciding factor.
Migration Decision Points — Comparing Continued OpenAPI vs TypeSpec Adoption
The team compared options:
| Aspect | Direct OpenAPI | TypeSpec Adoption |
|---|---|---|
| Description volume | Redundant, 33k+ lines | Significantly reduced |
| Readability | Deep nesting, hard to review | TS-like, easier to read |
| Lock-in | None | Avoided via OpenAPI output |
| Tool integration | Existing tools | Enhanced with linter, formatter, generators |
| Learning curve | Low for YAML users | Medium (lower for TS users) |
By always generating OpenAPI, the team retains access to the mature OpenAPI ecosystem. One caveat is the default interpretation of explode (true in OpenAPI, false in TypeSpec), which can be explicitly specified to avoid issues.
Source: freee Developers Hub
Actual Migration Steps and Development Flow
The migration followed this flow:
- Create TypeSpec definition files
- Apply built-in Linter and Formatter
- Compile TypeSpec to generate OpenAPI YAML
- Use ogen (Go) or orval (React) for code generation
- Review generated code and apply manual adjustments as needed
Leveraging prior experience from the spend management team, the billing team completed the migration smoothly. Existing OpenAPI assets were reused by regenerating from TypeSpec definitions.
Effects After Introduction and Remaining Challenges
Post-migration, the team reported that “directly reading or writing OpenAPI is no longer something we consider.” No critical issues have been reported.
The only remaining consideration is the explode default difference, which is easily managed with explicit declarations. TypeSpec has successfully balanced productivity and quality in API definition.
freee’s TypeSpec Usage Examples and Recommended Points
Following the spend management team, the billing team has fully adopted TypeSpec. Expansion to other teams is under consideration.
Recommended points: – Especially effective for teams managing large-scale APIs – Improves description quality while preserving the OpenAPI ecosystem – Backed by Microsoft official support and an active community
TypeSpec is emerging as a strong option for schema-driven development.
Source: freee Developers Hub TypeSpec Introduction
Frequently Asked Questions (FAQ)
Related articles:
- Sakana Fugu — Multi-agent System as A Model
- AWSに繋げなくてもテストできる?新サービス「AWS Blocks」を触ってみた
- 画面操作を“録画”→AIが作業代行 Codexに新機能「Record & Replay」
Author
krona23
Over 20 years in the IT industry, serving as Division Head and CTO at multiple companies running large-scale web services in Japan. Experienced across Windows, iOS, Android, and web development. Currently focused on AI-native transformation. At DevGENT, sharing practical guides on AI code editors, automation tools, and LLMs in three languages.

![What is Sakana Fugu? Sakana AI's Multi-Agent System Explained [2026 Latest]](https://i0.wp.com/devgent.org/wp-content/uploads/2026/06/codex-eyecatch-3852.webp?fit=300%2C169&ssl=1)






Leave a Reply