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

+4
View File
@@ -50,3 +50,7 @@ def init_app(app: Flask) -> None:
api.register_blueprint(sessions.blp, url_prefix="/api/v1/sessions")
api.register_blueprint(tokens.blp, url_prefix="/api/v1/tokens")
api.register_blueprint(stats.blp, url_prefix="/api/v1/me")
from scrobbler.openapi import lastfm
lastfm.register(app, api)
+1 -1
View File
@@ -6,7 +6,7 @@ from scrobbler.schemas import ApiAppCreateSchema, ApiAppSchema, ErrorSchema
from scrobbler.services import accounts
blp = Blueprint(
"ui_apps",
"Apps",
__name__,
description=(
"API applications. Each has an API key and shared secret that a scrobbling "
+1 -1
View File
@@ -6,7 +6,7 @@ from scrobbler.api.decorators import authenticated, bearer_token
from scrobbler.schemas import ErrorSchema, LoginSchema, RegisterSchema, TokenSchema, UserSchema
from scrobbler.services import accounts
blp = Blueprint("ui_auth", __name__, description="Web UI accounts and login")
blp = Blueprint("Auth", __name__, description="Web UI accounts and login")
@blp.route("/register", methods=["POST"])
+1 -1
View File
@@ -6,7 +6,7 @@ from scrobbler.schemas import ErrorSchema, SessionSchema
from scrobbler.services import accounts
blp = Blueprint(
"ui_sessions",
"Sessions",
__name__,
description="Last.fm session keys issued to scrobbling clients on your behalf.",
)
+1 -1
View File
@@ -14,7 +14,7 @@ from scrobbler.schemas import (
)
from scrobbler.services import scrobbles, stats
blp = Blueprint("ui_stats", __name__, description="Your listening history and statistics")
blp = Blueprint("Stats", __name__, description="Your listening history and statistics")
TOP_KINDS = {
"artists": stats.top_artists,
+1 -1
View File
@@ -6,7 +6,7 @@ from scrobbler.schemas import ApproveTokenSchema, AuthTokenInfoSchema, ErrorSche
from scrobbler.services import accounts
blp = Blueprint(
"ui_tokens",
"Tokens",
__name__,
description=(
"Approve Last.fm desktop-auth tokens. Clients send the user to `/api/auth/`, "