Day 5: We scanned a 200-route codebase into OpenAPI without uploading a file
Описание и применение
Создан точный документ OpenAPI для наследуемого сервиса Express с 200 маршрутами, используя локальный AST‑сканер Powerduck, который выявляет пробелы и позволяет вручную их исправлять, а также опционально использовать ИИ для подсказок.
Задача
Reverse-engineering an accurate OpenAPI spec for a legacy 200-route Express service without uploading source code to external services.
Результат
Generated a trustworthy OpenAPI spec for a legacy Express service, with explicit gap flags and optional AI assistance, enabling reliable contract reuse and reducing documentation effort to iterative rescans.
Рабочий процесс
- 1. Run Powerduck desktop code scan on local repository using @powerduck/code-to-openapi engine.
- 2. Scanner performs AST walk to resolve route prefixes, parameters, and handler bindings across nested routers.
- 3. Schemas inferred from type systems (TypeScript interfaces, Pydantic models, Java DTOs, Go structs, C# records).
- 4. Engine flags gaps (e.g., body-schema-unknown, auth-unknown) instead of guessing.
- 5. Each discovered route appears in a review dialog with method, path, confidence, and gap list.
- 6. Optional AI resolver can be invoked per gap to propose schemas, awaiting human approval.
- 7. Scan writes a discovery sidecar; subsequent rescans produce diffs (new, removed, renamed routes).
- 8. Merge diffs into existing spec, preserving manual edits and descriptions.
- 9. Use the resulting spec for mocks, scenarios, documentation, and MCP server.
- 10. Repeat rescans each sprint to keep contract honest.
Доказательства
What actually worked was a dedicated AST scanner with an explicit human review gate.
The scanner I used (Powerduck's desktop code scan, powered by the open @powerduck/code-to-openapi engine) covers eight languages…
Every discovered route lands in a review dialog with its method, reconstructed path, confidence level, and gap list.
Two properties make this safe for proprietary code. The scan runs entirely on the local machine; source is never uploaded.
- Дата записи: 2026-10-03T16:40:54.716Z