Skip to content

docs(downgrader): note Kiota skipping a union branch that is an allOf holding a $ref - #145

Merged
dinwwwh merged 1 commit into
mainfrom
claude/project-thread-vbiclz
Oct 27, 2026
Merged

dinwwwh merged 1 commit into
mainfrom
claude/project-thread-vbiclz

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 27, 2026

Copy link
Copy Markdown
Member

Requested by dinwwwh · project thread

Docs only. Adds one sentence to the Kiota bullet in packages/downgrader/README.md.

In 3.0, a $ref with siblings becomes { ...siblings, allOf: [{ $ref }] }. Kiota 1.36.1 drops a oneOf or anyOf branch with that shape. The wrapper on its own is fine, and so is a bare $ref branch. Checked with kiota generate -l CSharp:

Property Kiota C# type
3.0 oneOf [{ description, allOf: [$ref A] }, null branch] enum whose only member is Kiota's null sentinel
3.1 anyOf [{ description, $ref A }, { type: null }] A?
3.0 anyOf [{ description, allOf: [$ref A] }, { description, allOf: [$ref B] }] UntypedNode
3.1 same with $ref beside description union wrapper class
3.0 oneOf [{ description, allOf: [$ref A] }, $ref B] B only
3.0 { description, allOf: [$ref A] } alone A

oRPC with Zod 4 writes the first shape for A.describe('the a').nullable() when A has its own id. In OpenAI's spec, Kiota writes 75 properties as sentinel-only enums from 3.0 that it types from 3.1. 7 of 952 real docs in the corpus have the shape (Meilisearch, Discord, Exa Websets, Chroma).

Round 456 tried hoisting the annotations out of the branch, which fixes Kiota, but OpenAPI Generator then turns enum targets into new inline enums, so the shape stays and the note points to 3.1.

pnpm run check passes.


Generated by Claude Code

… holding a $ref

Kiota 1.36.1 drops a oneOf or anyOf branch that is the
{ description, allOf: [$ref] } wrapper a $ref with siblings becomes in
3.0. So a described nullable $ref comes out as an enum holding only
Kiota's null sentinel, and a union of described refs as UntypedNode or
as its other branches alone. 3.1 keeps the $ref beside its siblings,
which Kiota types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVaw7QpQQDqKaeH8NfdZqS
@dinwwwh dinwwwh self-assigned this Oct 27, 2026
@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks


Comparing claude/project-thread-vbiclz (ad82ae5) with main (e476ca2)

Open in CodSpeed

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

  • Kiota union-branch limitation note — adds one sentence to the Kiota bullet in packages/downgrader/README.md stating that Kiota drops a oneOf/anyOf branch shaped as allOf: [{ $ref }] (what a 3.0 $ref-with-siblings becomes), so a described nullable $ref comes out as an enum holding only Kiota's null sentinel, and a union of such branches as UntypedNode or as its other branches alone.

I verified the claim against Kiota v1.36.1 source. The wrapper branch fails IsSemanticallyMeaningful (src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs:317-329), so IsExclusiveUnion/IsInclusiveUnion (which require > 1 meaningful members) do not treat it as a union member; KiotaBuilder.cs:2139-2141 then collapses to the only meaningful child (the null branch), and :2230 returns UntypedNode when none exists. The null branch's enum: [null] becomes a String-kind sentinel enum, matching the "null sentinel" wording. The downgrader really emits that shape (v3.1-to-v3.0.ts:1033-1035, pinned by tests/v3.1-to-v3.0.test.ts:964-978). The 3.1 side is also correct: a $ref beside description parses as a reference and is kept. uncheck packages/downgrader/README.md (oxlint + oxfmt) passes.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@dinwwwh
dinwwwh merged commit 7e65844 into main Oct 27, 2026
11 checks passed
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.

2 participants