Stop naming what the register's other entries are, and say where the booleans stay text
Tests / vet + fmt + tests (pull_request) Successful in 1m26s
Tests / Gitea release from CHANGELOG.md (pull_request) Has been skipped

This commit is contained in:
2026-09-20 00:36:38 +02:00
parent caec22001d
commit 4472c8d92b
3 changed files with 16 additions and 6 deletions
+4 -3
View File
@@ -173,9 +173,10 @@ select a row; `car` and `useragent` carry no key or name, so they are drawn from
than selected in.
`misc.httpmethod`, `misc.protocol` and `misc.port` are IANA's registries.
`misc.httpmethod` is the nine methods the HTTP core specification defines, not the
WebDAV extensions the register also holds, and its `safe` and `idempotent` are `true`
or `false`, so a Go `bool` reads them. `misc.protocol` carries a `number` and a `name`,
`misc.httpmethod` is the nine methods the HTTP core specification defines; the
register's other entries, WebDAV and DeltaV among them, do not ship. Its `safe` and
`idempotent` are `true` or `false`, so a Go `bool` reads them, though `--format json`
and `sql` write them as text, a table column carrying no datatype. `misc.protocol` carries a `number` and a `name`,
the keyword itself where the register spells none out, and selects by either spelling.
`misc.port` is the TCP assignments, rendering the number a port field holds with the
IANA `service` beside it, and selecting by number alone. A draw spans the whole
+6 -3
View File
@@ -4,9 +4,9 @@
data-import/httpmethod.py [--source URL_OR_FILE] [--cache DIR] [--out FILE]
A method ships when the register cites the HTTP core specification for it, RFC 9110
section 9.3 or RFC 5789, which is the nine a request carries; the WebDAV and DeltaV
extensions the register also holds do not. The register's `yes` and `no` ship as `true`
and `false`, which a consumer's boolean reads.
section 9.3 or RFC 5789, which is the nine a request carries; the register's other
entries do not. The register's `yes` and `no` ship as `true` and `false`, which a
consumer's boolean reads.
"""
import argparse
import csv
@@ -24,6 +24,7 @@ CACHE = Path(__file__).resolve().parent / "cache"
COLUMNS = ["idempotent", "method", "safe"]
CORE = re.compile(r"\[RFC9110, Section 9\.3\.|\[RFC5789, Section 2\]")
BOOLEAN = {"yes": "true", "no": "false"}
SELECTOR = '[]{}"|' # mirrors inSelector in table.go
EXPECTED = 9
@@ -32,6 +33,8 @@ def rows(text):
method = (r["Method Name"] or "").strip()
if not CORE.search(r["Reference"] or ""):
continue
if set(method) & set(SELECTOR):
sys.exit(f"{method}: a method holding one of {SELECTOR} is one a selector cannot spell")
answers = {}
for column in ("Safe", "Idempotent"):
answer = (r[column] or "").strip()
+6
View File
@@ -103,10 +103,16 @@ by a `data-import/` script, as README goal 10 asks.
- Add `{base64url(n)}` for JWT shapes.
- Add a `unix` layout to `date()` once something needs it.
### Library and CLI
- Name a spelling that works when a row selector misses: `misc.protocol[tcp]`,
`misc.httpmethod[get]` and `misc.territory[se]` all answer "no row … has key or name"
and stop there, where a case-insensitive match could name the row that exists, and a
table with no `name` column could say it selects by key alone.
- Let a table column carry a `datatype`, so `--format json` writes
`"safe": true` and `--format sql` a boolean rather than the text `'true'`. Today only
a JSON field takes one, so `misc.httpmethod`'s booleans are typed in Go and text
everywhere else. It reserves a field name, so it is a fence and a major.
### Open questions to settle