https://github.com/nicksenap/qi
Qi is a tool that enhances contract-based development workflow by providing more intelligent code generation from OpenAPI specifications.
https://github.com/nicksenap/qi
api-first code-generation contract-first-development python spring-boot
Last synced: 5 months ago
JSON representation
Qi is a tool that enhances contract-based development workflow by providing more intelligent code generation from OpenAPI specifications.
- Host: GitHub
- URL: https://github.com/nicksenap/qi
- Owner: nicksenap
- Created: 2024-12-27T22:34:47.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-12-29T21:37:00.000Z (12 months ago)
- Last Synced: 2025-05-18T02:49:41.069Z (7 months ago)
- Topics: api-first, code-generation, contract-first-development, python, spring-boot
- Language: Python
- Homepage:
- Size: 185 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Qi - Better Workflow for Contract-Based Development
[](https://github.com/nicksenap/qi/actions/workflows/test.yml)
[](https://codecov.io/gh/nicksenap/qi)
Qi (契, means contract in Chinese) is a tool that enhances contract-based development workflow by providing more intelligent code generation from OpenAPI specifications. Currently supporting Java Spring Boot, with planned support for FastAPI and other frameworks.
## Features
- Automatically downloads and manages OpenAPI Generator CLI
- Supports custom directory mapping via `x-qi-dir` extension
- Tracks generated files for smart updates
- Currently supports Java Spring Boot projects (FastAPI and other frameworks coming soon)
## Installation
First, make sure you have `uv` installed:
```bash
pip install uv
```
Then install QI:
```bash
uv pip install .
```
## Usage
### Basic Usage
```bash
qi generate path/to/spec.yaml -o ./target
```
### With Configuration File
Create a configuration file `qi-config.yaml`:
```yaml
openapi_generator_version: "6.6.0"
java_package_base: "com.example"
model_package: "model"
api_package: "api"
tracking_file: ".qi-tracking.yaml"
```
Then run:
```bash
qi generate path/to/spec.yaml -c qi-config.yaml -o ./target
```
### OpenAPI Specification Example
```yaml
components:
schemas:
User:
x-qi-dir: "domain/user/model" # Custom directory for User model
type: object
properties:
id:
type: string
format: uuid
name:
type: string
```
## Development
### Setup
```bash
# Install development dependencies
make install.dev
# Run tests
make test # All tests
make test.unit # Unit tests only
make test.integration # Integration tests only
# Code quality
make lint # Check code style
make fix # Auto-fix code style issues
make check # Run all quality checks
```
## Requirements
- Python 3.10+
- Java Runtime Environment (JRE) for OpenAPI Generator
- uv for dependency management