Skip to content

ListMyDrafts: the my-drafts surface, with required-nullable object references (#12381) - #524

Merged
jeremy merged 5 commits into
mainfrom
c6-drafts
Jul 31, 2026
Merged

ListMyDrafts: the my-drafts surface, with required-nullable object references (#12381)#524
jeremy merged 5 commits into
mainfrom
c6-drafts

Conversation

@jeremy

@jeremy jeremy commented Jul 31, 2026

Copy link
Copy Markdown
Member

C6 of the post-v0.11.0 absorption sprint, on the C5 template.

BC3 #12381 shipped GET /my/drafts.json — the current user's unpublished messages, documents, uploads, and client approvals/correspondences (capped at 250, like /my/assignments). Drafts are private per-user; without this an integration cannot enumerate unpublished work.

What

  • Spec: new DraftsService (tag Drafts, default-fallback mapping — zero overrides) with ListMyDrafts; flat purpose-built Draft envelope (NOT the recording projection). 230 → 231 operations.
  • Required-nullable modeling: parent and scheduled_posting_at are present on every element and null when bucket-rooted/unscheduled. The scalar uses the established ["string","null"] jsonAdd; parent is the spec's first required-nullable object reference, spelled anyOf: [$ref, {type: "null"}] + x-go-type *DraftParent.
  • Generator work (the substantive half of this PR): that anyOf shape previously degraded — Kotlin→JsonElement, Swift→String, Python→Any (TS/Go were fine). All three generators now resolve it to the referenced model, nullable: Kotlin's resolvePropertyType, Swift's schemaIsNullable/schemaToSwiftType and its supporting-model collector (the $ref hides inside the union — DraftParent was silently never emitted, breaking the Swift build), Python's schema_to_type. Kotlin's supporting-type scanner still doesn't traverse anyOf, so DraftParent is listed explicitly in TYPE_ALIASES with a comment. End state: Go *DraftParent, TS DraftParent | null, Kotlin DraftParent?, Swift DraftParent?, Python DraftParent | None.
  • Wiring: Go wrapper + accessor, TS/Ruby/Python(sync+async) clients; Kotlin/Swift accessors generated.
  • Tests + conformance: each SDK decodes a feed with one bucket-rooted draft and asserts present-null stays null; the paths.json mock is bucket-rooted so all five runners pin the nullable decode (4 passes + TS totals).
  • Counts: union 192→193 (one new GET); idempotent stays 73. Registry flipped with the treatment documented.

Verification

Full make green (exit 0) + make kt-check-generated-drift clean.


Summary by cubic

Adds the my-drafts surface: DraftsService with ListMyDrafts (GET /my/drafts.json) and a flat Draft envelope to list a user’s unpublished work. Also updates generators so Kotlin, Swift, and Python correctly model required-but-nullable object refs, fixing null handling for parent and scheduled_posting_at.

  • New Features

    • New DraftsService and ListMyDrafts endpoint; paginated via Link (server cap 250).
    • Flat Draft envelope with bucket, and required-nullable parent and scheduled_posting_at.
    • Client wiring in Go, TypeScript, Ruby, Python (sync/async), Kotlin, and Swift; accessors added.
    • Tests and conformance: bucket-rooted draft (parent: null) pinned in all SDKs; 401 cases covered.
    • Counts updated: 231 operations; retry-eligible union 193; docs/metadata refreshed.
  • Generators

    • Kotlin, Swift, and Python now resolve anyOf: [$ref, {type:"null"}] to a nullable model type (TS/Go already correct).
    • Swift collector traverses anyOf; Kotlin lists DraftParent in TYPE_ALIASES pending scanner support.

Written for commit 9b0fc97. Summary will update on new commits.

Review in cubic

jeremy added 5 commits July 31, 2026 04:59
…velope

BC3 #12381 shipped GET /my/drafts.json — the current user's unpublished
messages, documents, uploads, and client approvals/correspondences,
capped at 250. The Draft envelope is flat and purpose-built, NOT the
shared recording projection. 230 -> 231 operations.

parent and scheduled_posting_at are present on every element and null
when bucket-rooted/unscheduled — modeled required-and-nullable: the
scalar via the established ["string","null"] jsonAdd, and parent (an
object) via anyOf: [$ref, {type: "null"}] with x-go-type *DraftParent,
the first required-nullable object reference in the spec.
anyOf: [$ref, {type: "null"}] — the OpenAPI 3.1 spelling of a
present-but-nullable reference — previously degraded per generator:
Kotlin to JsonElement, Swift to String, Python to Any (TS and Go
already handled it). Kotlin resolves the union to the referenced model
nullable-regardless-of-requiredness; Swift extends schemaIsNullable +
schemaToSwiftType and the supporting-model collector (the $ref hides
inside the union, so DraftParent was never emitted and the build broke);
Python resolves the union to 'Model | None'. Kotlin's supporting-type
scanner still doesn't traverse anyOf, so DraftParent is listed
explicitly in TYPE_ALIASES with a comment.
Go drafts.go wrapper (typed Draft with *DraftParent / *time.Time
nullables) + AccountClient.Drafts(); TS client.drafts + root
re-exports; Ruby client.rb; Python sync and async clients.
TS/Ruby/Python each decode a two-element feed where one draft is
bucket-rooted (parent: null, scheduled_posting_at set) and assert the
null survives as null rather than collapsing; 401 surfaces as each
SDK's auth error. paths.json case uses a bucket-rooted mock so all
five runners pin the required-nullable decode; dispatch added in all
five.
Union 192->193 (one new GET); idempotent stays 73. SPEC ceiling
narrative and Appendix E, SECURITY's 120 GETs, AGENTS totals.
my-drafts flips to absorbed-in-sdk with four smithy_refs and the
generator-treatment note; README row.
Copilot AI review requested due to automatic review settings July 31, 2026 12:00
@github-actions github-actions Bot added documentation Improvements or additions to documentation typescript Pull requests that update TypeScript code ruby Pull requests that update the Ruby SDK go kotlin swift spec Changes to the Smithy spec or OpenAPI conformance Conformance test suite python Pull requests that update the Python SDK labels Jul 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jeremy

jeremy commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Copilot errored on review (persistent service-side pattern today) and Codex didn't pick this PR up within its window. Merging on green CI: full local make + Kotlin drift gate exit 0, present-null decode pinned in all five conformance runners and per-SDK tests.

@jeremy
jeremy merged commit 5e7c2cc into main Jul 31, 2026
44 of 45 checks passed
@jeremy
jeremy deleted the c6-drafts branch July 31, 2026 12:29
@jeremy jeremy added the enhancement New feature or request label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conformance Conformance test suite documentation Improvements or additions to documentation enhancement New feature or request go kotlin python Pull requests that update the Python SDK ruby Pull requests that update the Ruby SDK spec Changes to the Smithy spec or OpenAPI swift typescript Pull requests that update TypeScript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants