Legacy Code Night Shift: Drafting a Living API Contract with a Free Model and a Free Server
Описание и применение
Автоматизированный рабочий процесс, использующий бесплатную модель LLM для генерации схем JSON и бесплатный сервер для ночной проверки API, позволяет быстро обнаруживать изменения в ответах Flask‑приложения.
Задача
Inherited a Flask app without an OpenAPI spec or contract tests, making it hard to know expected responses before refactoring.
Результат
Implemented a repeatable, low-cost workflow that automatically drafts and validates API contracts, reducing refactor risk and catching payload changes before production exposure.
Рабочий процесс
- Extract routes and view source from Flask app
- Send each route’s source to a free LLM to generate a JSON Schema
- Store generated schemas in a contracts/ folder
- Run a free server nightly to validate each endpoint against its schema and report drift
Доказательства
A free model can draft that contract while you sleep, and a free server can validate it every morning.
Keep the temperature at zero. You are not asking for creative descriptions; you want deterministic output that the validator can rely on.
- Дата записи: 2026-09-05T18:23:00.796Z