CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 1m5s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
- /api/v1/federation/settings (GET, PATCH): sharing on/off, visibility (followers-only default), follow approval, discoverable/indexable, display name and bio, plus the read-only handle and URLs - /api/v1/federation/profiles/<name>: public profile for the UI page, only for users sharing - ActivityPub endpoints documented under an ActivityPub tag - docs/openapi.json is now exported with every optional module on (python -m scrobbler.openapi.export); the drift test and route checks cover both a federation-off and a federation-on app - Boundary: federation may use scrobbler.api.get_api to register its blueprint; the checker proves other scrobbler.api modules stay off limits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
"""Write docs/openapi.json: the API as documented with every optional module enabled.
|
|
|
|
uv run python -m scrobbler.openapi.export docs/openapi.json
|
|
|
|
A running server's own /api/openapi.json only lists what it has enabled.
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
|
|
from scrobbler.config import Config
|
|
|
|
|
|
class DocsConfig(Config):
|
|
START_METRICS_SERVER = False
|
|
UI_BASE_URL = "https://scrobble.example"
|
|
FEDERATION_ENABLED = "1"
|
|
FEDERATION_DOMAIN = "scrobble.example"
|
|
FEDERATION_BASE_URL = "https://scrobble.example"
|
|
FEDERATION_KEY_SECRET = "documentation-only-not-a-real-secret-0000"
|
|
|
|
|
|
def build_spec() -> dict:
|
|
from scrobbler import create_app
|
|
from scrobbler.api import get_api
|
|
|
|
app = create_app(DocsConfig)
|
|
with app.app_context():
|
|
return get_api(app).spec.to_dict()
|
|
|
|
|
|
def main(argv: list[str]) -> None:
|
|
path = argv[1] if len(argv) > 1 else "docs/openapi.json"
|
|
with open(path, "w") as out:
|
|
json.dump(build_spec(), out, indent=2, ensure_ascii=False)
|
|
out.write("\n")
|
|
print(f"wrote {path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main(sys.argv)
|