You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add batch Subject-ID minting and client-supplied create IDs (#1101)
Fixes#1100
Importing many interlinked Subjects needs their IDs known before the Subjects
exist, so relation statements can be wired client-side and the Subjects created
in any order. Two additions cover this:
- POST /neowiki/v0/subject-ids mints a batch of fresh, distinct, format-valid
Subject IDs. Body `count` (1-1000). Stateless: no reservation and no graph
dependency. Access model matches the validate endpoint (no write access, no
CSRF, no page authorization). A small application-layer SubjectIdMinter holds
the dedupe/regenerate loop; the handler enforces the count range.
- The create endpoints accept an optional `id`. When present it is format-checked
at the request boundary (400) and rejected when already in use (409), both
against the page's own Subjects and, best-effort, the graph's subject->page
index. When absent the server mints as before, and the default create path
gains no new graph dependency.
Also closes a duplicate-guard gap that client-supplied IDs make reachable: the
page-local create guards now consider every Subject on the page (main and
children), not just the sibling collection.
Global Subject-ID uniqueness stays best-effort: the subject->page index lags slot
writes and ID entropy carries the rest, the same posture already used for
client-supplied relation IDs.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/api/rest-api.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,7 @@ Read, change, and validate Subjects. New Subjects are created on a page — see
53
53
|`DELETE /neowiki/v0/subject/{subjectId}`| Delete a Subject. |
54
54
|`POST /neowiki/v0/subject/validate`| Check whether a new Subject is valid, without saving it. |
55
55
|`POST /neowiki/v0/subject/{subjectId}/validate`| Check whether a change to a Subject is valid, without saving it. |
56
+
|`POST /neowiki/v0/subject-ids`| Mint a batch of unused Subject IDs to assign on create, e.g. to wire relations across an interlinked import. Body `count` (1–1000). |
56
57
|`GET /neowiki/v0/subject-labels`| Find Subjects of a Schema by label; returns `id`/`label` pairs. |
Create a Subject on a page from a [Subject object](#subject-object) (`label`, `schema`, `statements`),
209
+
with an optional `comment` edit summary.
210
+
211
+
The Subject ID is normally minted server-side. To set it yourself — for example to wire relations across
212
+
a batch before the target Subjects exist — pass an optional `id`:
213
+
214
+
| Field | Required | Notes |
215
+
|---|---|---|
216
+
|`id`| No | Subject ID to assign. Must be well-formed (`400` otherwise) and unused (`409` otherwise). Omit to have the server mint one. Pre-mint a batch of IDs with `POST /neowiki/v0/subject-ids`. |
217
+
218
+
After creation the ID is immutable; the replace endpoint below ignores it.
0 commit comments