simonw / simonw/datasette

Redesign row default JSON

Open
#2,137 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

json-api
Dominant language
Python
Stars
11.5k
Forks
904
Avg merge
4d 17h
Merged PRs (30d)
18

Description

This URL here:

https://latest.datasette.io/fixtures/simple_primary_key/1.json?_extras=foreign_key_tables

{
  "database": "fixtures",
  "table": "simple_primary_key",
  "rows": [
    {
      "id": "1",
      "content": "hello"
    }
  ],
  "columns": [
    "id",
    "content"
  ],
  "primary_keys": [
    "id"
  ],
  "primary_key_values": [
    "1"
  ],
  "units": {},
  "foreign_key_tables": [
    {
      "other_table": "foreign_key_references",
      "column": "id",
      "other_column": "foreign_key_with_blank_label",
      "count": 0,
      "link": "/fixtures/foreign_key_references?foreign_key_with_blank_label=1"
    },
    {
      "other_table": "foreign_key_references",
      "column": "id",
      "other_column": "foreign_key_with_label",
      "count": 1,
      "link": "/fixtures/foreign_key_references?foreign_key_with_label=1"
    },
    {
      "other_table": "complex_foreign_keys",
      "column": "id",
      "other_column": "f3",
      "count": 1,
      "link": "/fixtures/complex_foreign_keys?f3=1"
    },
    {
      "other_table": "complex_foreign_keys",
      "column": "id",
      "other_column": "f2",
      "count": 0,
      "link": "/fixtures/complex_foreign_keys?f2=1"
    },
    {
      "other_table": "complex_foreign_keys",
      "column": "id",
      "other_column": "f1",
      "count": 1,
      "link": "/fixtures/complex_foreign_keys?f1=1"
    }
  ],
  "query_ms": 4.226590999678592,
  "source": "tests/fixtures.py",
  "source_url": "https://github.com/simonw/datasette/blob/main/tests/fixtures.py",
  "license": "Apache License 2.0",
  "license_url": "https://github.com/simonw/datasette/blob/main/LICENSE",
  "ok": true,
  "truncated": false
}

That ?_extras= should be ?_extra= - plus the row JSON should be redesigned to fit the new default JSON representation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the row JSON response at the URL in the issue and inspect the fixture source mentioned there, tests/fixtures.py. Confirm the _extra spelling and determine the intended new default row representation before identifying the affected endpoint tests; done means the response uses the corrected parameter and the agreed representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.