AOSSIE-Org / AOSSIE-Org/PictoPy

BUG: Backend startup writes to tracked docs/backend/backend_python/openapi.json, dirtying the working tree

Aperta
#1,512 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug enhancement
Lingua principale
Python
Stelle
283
Fork
679
Merge medio
7g 2h
PR unite (30g)
3

Descrizione

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

`generate_openapi_json()` is called during backend startup (`backend/main.py:76`) and writes the schema directly into the tracked file `docs/backend/backend_python/openapi.json` (`backend/main.py:~154-161`). As a result, simply running the backend leaves the git working tree dirty.

**Steps to reproduce:**
1. Fresh clone, backend deps installed in a venv.
2. `cd backend && python main.py`, let it start, then stop it.
3. `git status` → `docs/backend/backend_python/openapi.json` shows as modified.

On my clone the resulting diff was 31 lines (25 insertions, 6 deletions), so the committed copy is also currently out of sync with what the code generates.

**Why this matters**

Any contributor who runs the backend gets a spurious modification to a committed file. It's easy to `git add .` and commit it by accident, and it adds noise to `git status` during normal development.

**Context**

The auto-generation of `openapi.json` on startup was introduced in #483 (Swagger docs integration), so the committed spec is intentional — this isn't a request to stop tracking it. There was also related interest in decoupling OpenAPI generation from app startup in #1167, which was closed unmerged only because no issue was linked. This issue is meant to be that tracking issue for the concrete symptom.

**Possible directions (open to maintainer preference)**

- Generate the spec via an explicit script / pre-commit hook / CI step rather than on every server start, and optionally have CI fail if it's stale.
- Or write it to a non-tracked build location and have the docs pipeline pull from there.

Happy to open a PR once maintainers confirm the preferred direction.

### Record

- [x] I agree to follow this project's Code of Conduct

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.