OpenAPI: document the Last.fm API and commit the exported spec
CI / lint (push) Successful in 10s
CI / test (push) Successful in 30s
CI / notify (push) Successful in 5s

- /2.0/ and /api/auth/ are described from the Last.fm method registry:
  method enum, per-method parameter tables, auth requirements, notes,
  request schemas and XML example responses
- Readable tags (Auth, Apps, Sessions, Tokens, Stats, Last.fm)
- docs/openapi.json is exported with `flask openapi write`; tests fail
  if it drifts from the code, if any route is undocumented, or if a UI
  route is missing its bearer-auth security declaration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
mattandClaude Opus 5.5 committed 2026-09-25 14:13:47 +01:00
1 parent b509cd2b60
commit 89f8589424
11 files changed
+2828 -14

No files matched your search

-9
View File
@@ -98,12 +98,3 @@ def test_cors_allows_only_the_configured_ui_origin(client, app):
"/api/v1/auth/me", headers={"Origin": "https://evil.example", **preflight}
)
assert "Access-Control-Allow-Origin" not in evil.headers
def test_api_docs_are_served(client):
spec = client.get("/api/openapi.json").get_json()
assert "/api/v1/auth/login" in spec["paths"]
assert spec["components"]["securitySchemes"]["bearerAuth"]["scheme"] == "bearer"
assert spec["paths"]["/api/v1/auth/me"]["get"]["security"] == [{"bearerAuth": []}]
assert client.get("/api/docs").status_code == 200
assert client.get("/api/redoc").status_code == 200