About InspeKtor¶
InspeKtor is a Kotlin compiler plugin that generates OpenAPI specifications from your Ktor routing code.
Why InspeKtor?¶
The Problem¶
Keeping API documentation in sync with code is hard:
- Annotation-based tools require verbose annotations that duplicate your code
- Runtime tools need your server running and may miss edge cases
- Manual specs quickly become outdated
The Solution¶
InspeKtor analyzes your Ktor routing DSL at compile time and generates accurate OpenAPI documentation automatically. It:
- Reads your actual route definitions
- Infers request/response types from your code
- Extracts documentation from KDoc comments
- Generates the spec as part of your normal build
Key Features¶
| Feature | Description |
|---|---|
| Zero Runtime | No impact on application performance |
| Type-Safe | Leverages Kotlin's type system |
| Minimal Annotations | Most information is inferred |
| Incremental | Fast rebuilds during development |
| Configurable | Extensive Gradle DSL |
How It Works¶
Text Only
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Kotlin Code │────▶│ Compiler Plugin │────▶│ OpenAPI Spec │
│ │ │ │ │ │
│ • Routes │ │ • Analyzes DSL │ │ • paths │
│ • Data classes │ │ • Resolves types │ │ • schemas │
│ • Annotations │ │ • Extracts docs │ │ • security │
└─────────────────┘ └──────────────────┘ └─────────────────┘
- You write Ktor routes normally
- Add
@GenerateOpenApito your module function - Build your project
- Get a complete OpenAPI specification
Project Links¶
About This Documentation¶
This documentation is built with MkDocs and the Material for MkDocs theme.
Acknowledgments¶
InspeKtor is built on top of: