Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual environments
venv/
ENV/
env/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# Git
.git/
.gitignore

# CI/CD
.github/

# Documentation
*.md
!README.md

# Test
.pytest_cache/
.coverage
htmlcov/
.tox/

# Generated files
app.py
endpoints_data.json
openapi.json
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Lint with ruff
run: |
ruff check src/ tests/
- name: Format check with ruff
run: |
ruff format --check src/ tests/
- name: Type check with mypy
run: |
mypy src/
- name: Test with pytest
run: |
pytest
- name: Upload coverage reports to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
24 changes: 20 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,26 @@ ENV/
# venv
venv/

# files generated / used by app
src/app.py
src/proposed_endpoints.md
src/endpoints_data.json
# Generated files from API stub generator
app.py
endpoints_data.json
openapi.json
proposed_endpoints.md

# Configuration (keep example)
.stubrc.yml
.stubrc.yaml
stub.yml
stub.yaml

# IDE
.vscode/
.idea/
*.swp
*.swo

# tests cache
.pytest_cache/

# Ruff cache
.ruff_cache/
24 changes: 24 additions & 0 deletions .stubrc.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# API Stub Generator Configuration File
# Copy this file to .stubrc.yml and customize as needed

# Input markdown file with proposed endpoints
input_file: proposed_endpoints.md

# Output JSON file for parsed endpoints
output_file: endpoints_data.json

# Generated application file
app_file: app.py

# Framework to use: flask or fastapi
framework: flask

# Enable CORS for all routes
enable_cors: true

# Enable debug/development mode with auto-reload
debug_mode: true

# Server configuration
port: 5000
host: localhost
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

41 changes: 38 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
Changelog
=========

Features & Improvements
-----------------------
## [0.2.0] - 2025-01-09

#### 2019-1-29
### 🎉 Major Release - Complete Rewrite

#### Added
- **CLI Interface**: New `api-stub-gen` command with subcommands (`generate`, `watch`, `serve`)
- **FastAPI Support**: Generate FastAPI applications with async support and auto-docs
- **Watch Mode**: Auto-regenerate stubs when markdown files change
- **Configuration Files**: YAML config file support (`.stubrc.yml`)
- **OpenAPI Generation**: Auto-generate OpenAPI 3.0 specifications
- **CORS Support**: Built-in CORS for Flask and FastAPI apps
- **Hot Reload**: Debug mode with auto-reload enabled by default
- **Template System**: Jinja2-based code generation (replaces string concatenation)
- **Validation**: Comprehensive endpoint validation with helpful error messages
- **Docker Support**: Dockerfile and docker-compose.yml for containerization
- **Type Hints**: Full type annotations throughout the codebase
- **Test Coverage**: Comprehensive test suite for all new features
- **Health Endpoint**: Built-in `/health` endpoint for monitoring

#### Changed
- **Python Version**: Minimum Python 3.10 (was 3.7)
- **Dependencies**: Updated to latest versions (Flask 3.0+, pytest 7.4+)
- **CI/CD**: Migrated from Travis CI to GitHub Actions
- **Linting**: Replaced flake8 with Ruff for faster linting and formatting
- **Project Structure**: Added `pyproject.toml` following PEP 621 standards
- **Documentation**: Complete README rewrite with examples and comparisons

#### Deprecated
- Direct usage of `serialize_data.py` and `create_mock_endpoints.py` (use CLI instead)
- Pipenv as primary dependency manager (pip recommended)

#### Fixed
- Better error handling for malformed markdown
- Proper validation of HTTP methods and endpoint formats
- Unicode handling in endpoint descriptions

## [0.1.0] - 2019-01-29

### Features & Improvements

- Allow `serialize_data.py` accept path for proposed endpoints docs as command line argument. ([@mansiag])

Expand Down
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.12-slim

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application
COPY . .

# Install the package
RUN pip install -e .

# Default command
CMD ["api-stub-gen", "generate"]
17 changes: 0 additions & 17 deletions Pipfile

This file was deleted.

Loading