ok: true in /db.json for consistency

This commit is contained in:
Simon Willison 2026-04-15 15:44:06 -07:00
commit 5f39036b9b
4 changed files with 10 additions and 0 deletions

View file

@ -130,6 +130,7 @@ class DatabaseView(View):
actor=request.actor,
)
json_data = {
"ok": True,
"database": database,
"private": private,
"path": datasette.urls.database(database),

View file

@ -3,6 +3,12 @@
=========
Changelog
=========
.. dev:
dev
---
- The ``/<database>.json`` endpoint now includes an ``"ok": true`` key, for consistency with other JSON API responses.
.. _v1_0_a26:

View file

@ -40,6 +40,8 @@ The JSON version of this page provides programmatic access to the underlying dat
* `fivethirtyeight.datasettes.com/fivethirtyeight.json <https://fivethirtyeight.datasettes.com/fivethirtyeight.json>`_
* `datasette.io/global-power-plants.json <https://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

View file

@ -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