From 5f39036b9bebcece55e6657446c69105ef8322c6 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 15 Apr 2026 15:44:06 -0700 Subject: [PATCH] ok: true in /db.json for consistency --- datasette/views/database.py | 1 + docs/changelog.rst | 6 ++++++ docs/pages.rst | 2 ++ tests/test_api.py | 1 + 4 files changed, 10 insertions(+) diff --git a/datasette/views/database.py b/datasette/views/database.py index 916cdbc1..faf870d0 100644 --- a/datasette/views/database.py +++ b/datasette/views/database.py @@ -130,6 +130,7 @@ class DatabaseView(View): actor=request.actor, ) json_data = { + "ok": True, "database": database, "private": private, "path": datasette.urls.database(database), diff --git a/docs/changelog.rst b/docs/changelog.rst index adb62d42..005e5d7f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,6 +3,12 @@ ========= Changelog ========= +.. dev: + +dev +--- + +- The ``/.json`` endpoint now includes an ``"ok": true`` key, for consistency with other JSON API responses. .. _v1_0_a26: diff --git a/docs/pages.rst b/docs/pages.rst index a8a25fa7..34c851a5 100644 --- a/docs/pages.rst +++ b/docs/pages.rst @@ -40,6 +40,8 @@ The JSON version of this page provides programmatic access to the underlying dat * `fivethirtyeight.datasettes.com/fivethirtyeight.json `_ * `datasette.io/global-power-plants.json `_ +The returned object includes an ``"ok": true`` key alongside keys such as ``"database"``, ``"tables"``, ``"views"``, ``"queries"`` and ``"metadata"``. + .. _DatabaseView_hidden: Hidden tables diff --git a/tests/test_api.py b/tests/test_api.py index 3676c1fb..392030d6 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -59,6 +59,7 @@ async def test_database_page(ds_client): response = await ds_client.get("/fixtures.json") assert response.status_code == 200 data = response.json() + assert data["ok"] is True assert data["database"] == "fixtures" # Build lookup for easier assertions