Skip to content

feat(api-v1): describe the Work Items operations in the OpenAPI document, which now has all 32 of the pin's operations - #203

Merged
aRustyDev merged 1 commit into
mainfrom
feat/api-v1-openapi-work-items
Nov 16, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
feat/api-v1-openapi-work-items

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Part of #58; this PR does not close it.

The fourth and last of the per-resource steps of the schema diff (Projects was #179, States #188, Labels #193): the 14 Work Items operations are described by thrust-api-v1's OpenAPI document, written from the type the routes answer with, and scripts/check-openapi.sh now diffs all 32 operations of the scope m1. This is the series's end; whether #58 can close is yours, and I put no closing keyword in it.

For you to decide

D-033 (11), proposed: a form or multipart body is a 415 on a work item. The pin reads both, Thrust reads JSON only (request::json_body, one condition for every v1 route), and oasdiff reports the two media types removed from create_work_item and update_work_item (and their twins under work-items/). This is the fourth resource that raises it: you confirmed D-030 (5) for projects on 2026-11-07, and D-031 (5) (states), D-032 (6) (labels) and now D-033 (11) are proposed and not confirmed, each a new item of its own resource's record with its own register entries (SD-015 and SD-016 here), because I did not treat your answer for projects as covering the others. It is one condition for all the v1 routes, so one answer would settle all four. If you do not want it, the way out is for the routes to read forms, which is a feature, not a change to this PR.

What it does

  • IssueDto, the 29 keys of the pin's IssueSerializer (src/dto/work_items.rs), built by work_item_body. Where a body can say two things the type says both: a state, an assignee or a label is its id or, with expand, the object (StateRef, UserRef, LabelRef), so the expansions that were json! are typed (StateBriefDto, UserBriefDto, and the LabelDto of the label routes). The list answers Listing<T> (a page, or the one work item for an integration key), the search IssueSearchDto, and the five priorities are PriorityEnum, written once for the body and the two request descriptions.
  • Seven #[utoipa::path] with the pin's operation ids, summaries and response descriptions (create answers 201). The routes register both families of paths on the same handlers, so the document derives the work-items/ family from the issues/ one (WorkItemsTwice: the path, and the operation id followed by _2), and a test holds the two to be one set of operations.
  • IssueRequest and PatchedIssueRequest, hand-written descriptions of what the parser takes: every key it reads, with those it reads, checks and does not keep (D-033 (1)). The query types are the pin's, and the lookup by KEY-n lists fields and expand because the route takes them, which the pin's schema does not say.
  • Plan::envelope, which stood for the lists that were not types yet, is removed (its comment said it would go with the last resource).
  • The 14 operation ids in described.operations, the regenerated document, and the docs that said the diff covers some resources only (G-25, by-change.md, defect-matrix.md, standards.md, cicd.md, and five comments in the tooling that said "so far").

Two changes that touch every resource's document

  • An optional request body is the object, not oneOf [T, null]. utoipa writes Option<T> that way, which claims a null body that the routes refuse (400, "Request body must be a JSON object or array."; only an empty body is an empty object). OptionalBodies writes it as the pin does. It also lets oasdiff look inside the body: it reports "wrapped in a oneOf" and stops there. The update bodies of Projects, States and Labels change in the committed document; their findings do not (no new one appeared).
  • priority is allOf of the enum by reference, as the pin writes it. A bare reference left 52 findings, each of which would have needed an entry, and entries for an enum hide a value that is added. As the pin writes it, a sixth priority is a finding (below).

Findings

103 findings (83 errors, 20 warnings), 0 unaccepted, 0 stale, 0 ambiguous, by 22 entries (SD-015 to SD-022 are new). The first generation had 108 unaccepted; the two changes above took it to 54, of three kinds:

  • The form and multipart bodies (SD-015, SD-016): the question above.
  • The pin's schema against the pin's own answers, none of them a departure of Thrust's, each with its evidence in the entry: the search (the schema describes one hit as the whole answer, with a sequence_id that is a string; the recorded answer is {"issues": [...]} with a whole number: SD-017), the state (the schema says a uuid; the pin answers the object under expand, which the corpus's list-expand-assignees-labels-state records: SD-018 and SD-019) and the list (a page, or one work item for an integration key, which the schema does not describe: SD-020).
  • The range of sequence_id: an i64 here and an int32 there (SD-021, SD-022). A project would have to make two thousand million work items for the two to differ.

Two things I did not settle: the pin's schema lists external_id, external_source and order_by for a read by id, and the document lists them too, but I have not shown what the pin does with them there (the route ignores them, and a_read_by_id_takes_no_notice_of_a_key_or_an_order pins that); and the pin's Issue schema has no assignees or labels, which every body carries, so oasdiff has nothing to compare for them.

Checked

  • The wire is unchanged: the crate's tests 588 of 588 with the feature and 573 of 573 without it (22 new), the oracle gate and corpus comparison with G-25's numbers (162 cases, 12 failures all accepted; 108 exchanges, 36 of them Work Items, 13 accepted, 0 unaccepted; the comparison's controls and C0 to C4), the contract main pass 70 of 70, clippy clean for the crate with and without the feature, for the workspace and for the Worker on wasm32, and utoipa is not in the Worker's graph (cargo tree -i utoipa finds no package there, and utoipa v6.0.0 under thrust-api-v1 with the feature, which is the control).
  • Controls on the real code, each caught: a sixth priority turns 103 findings into 111, 8 unaccepted, and fails the test that ties the enum to the route; avatar_url skipped when null fails 3 tests (the new a_work_items_body_is_its_schema and two that existed, one recorded from the pin's seeded expansions); OptionalBodies left out fails its test; the second family's _2 made _3 fails the families test and the check; json_body made to read urlencoded forms fails exactly the 10 urlencoded cases of the four a_form_or_a_multipart_body_is_a_415 tests (2 each for Projects, States and Labels, 4 for Work Items) and no other.
  • A gap, as on the other three: nothing pinned that a form is a 415 on a work item.
  • All 15 steps of CI's deps job pass on this tree, and the document in the repository is the one the code writes.

Not run

native-pg, worker-memory and worker-cf (CI runs them), and the contract suite beyond native-memory main.

🤖 Generated with Claude Code

…ent, which now has all 32 of the pin's operations

The fourth and last of the per-resource steps of #58's schema diff (Projects #179, States #188, Labels #193). The 14 work item operations (seven under `issues/` and the same seven under `work-items/`) are in the document and in `described.operations`, so `scripts/check-openapi.sh` now diffs the 32 operations of the scope `m1` against `oasdiff`.

`IssueDto` is the 29 keys of the pin's `IssueSerializer`, and `work_item_body` builds it and serializes it. Where a body can say two things the type says both: a `state`, an assignee or a label is its id or, with `expand`, the object (`StateRef`, `UserRef`, `LabelRef`, over `StateBriefDto`, `UserBriefDto` and the `LabelDto` of the label routes), so the expansions that were `json!` are typed too. The list answers `Listing<T>`, a page or, when both halves of an integration key are named, the one work item; the search answers `IssueSearchDto`; the five names of a priority are `PriorityEnum`, written once for the body and the two request descriptions. The seven handlers carry `#[utoipa::path]` with the pin's operation ids, summaries and response descriptions (create answers 201). The routes register both families on the same handlers, so the document derives the `work-items/` family from the `issues/` one (`WorkItemsTwice`: the path, and the operation id followed by `_2`), and a test holds the two to be one set of operations. `Plan::envelope`, which stood for the lists that were not types yet, is gone.

Two things in the document changed for every resource. An optional request body was written `oneOf [T, null]`, which claims a `null` body that the routes refuse (400); `OptionalBodies` writes it as the object, as the pin does, which also lets `oasdiff` see inside it (it reports a body wrapped in a `oneOf` and stops there). And `priority` is `allOf` of the enum by reference, as the pin writes it: a bare reference left 52 findings that would each have needed an entry, and entries for an enum would hide a value that is added.

The wire is unchanged: the crate's tests 588 of 588 with the feature and 573 of 573 without it (22 new: 6 in `openapi.rs`, 16 in `work_items.rs`), the oracle gate and corpus comparison with the same numbers as G-25 (162 cases, 12 failures all accepted; 108 exchanges of which 36 are Work Items, 13 accepted, 0 unaccepted; the corpus comparison's controls and C0 to C4), the contract `main` pass 70 of 70, and clippy clean for the crate with and without the feature, for the workspace and for the Worker on wasm32 (`utoipa` is not in its graph).

103 findings (83 errors, 20 warnings), 0 unaccepted, 0 stale, 0 ambiguous, by 22 entries (SD-015 to SD-022 are new). The first generation had 108 unaccepted; what was left after the two changes above, 54, is of five kinds:

- The form and multipart bodies of the four operations that read a body (SD-015, SD-016). Thrust answers 415 to both, as on the other three resources, but D-030 (5) is the projects' and the owner confirmed it for projects only. It is D-033 (11) now, **proposed and not confirmed**.
- The pin's schema against the pin's own answers, each with its evidence and none of them a departure of Thrust's: the search (the schema describes one hit as the whole answer and a `sequence_id` that is a string; the recorded answer is `{"issues": [...]}` with a whole number: SD-017), the `state` (the schema says a uuid and the pin answers the object under `expand`, as the corpus's `list-expand-assignees-labels-state` records: SD-018, SD-019), and the list (a page, or the one work item for an integration key, which the schema does not describe: SD-020).
- The range of `sequence_id`: an i64 here and an int32 there (SD-021, SD-022).

Controls, each shown on the real code: a sixth priority in `PriorityEnum` turns 103 findings into 111, 8 unaccepted, and fails the test that ties the enum to the route; a `avatar_url` skipped when `null` fails 3 tests, the new `a_work_items_body_is_its_schema` and two that existed; the `OptionalBodies` modifier left out fails its test; the `_2` of the second family made `_3` fails the families test and the check (the document is not what the code writes); and `json_body` made to read urlencoded forms fails exactly the 10 urlencoded cases of the four `a_form_or_a_multipart_body_is_a_415` tests (2 each for Projects, States and Labels, 4 for Work Items). Nothing pinned a 415 for a form on a work item before.

Not run here: `native-pg`, `worker-memory` and `worker-cf`, which CI runs.

Refs: #58
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 620efac into main Nov 16, 2026
35 checks passed
@aRustyDev
aRustyDev deleted the feat/api-v1-openapi-work-items branch November 16, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant