Repository navigation
docs(downgrader): note Kiota skipping a union branch that is an allOf holding a $ref - #145
Conversation
… 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
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Kiota union-branch limitation note — adds one sentence to the Kiota bullet in
packages/downgrader/README.mdstating that Kiota drops aoneOf/anyOfbranch shaped asallOf: [{ $ref }](what a 3.0$ref-with-siblings becomes), so a described nullable$refcomes out as an enum holding only Kiota's null sentinel, and a union of such branches asUntypedNodeor 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.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Requested by dinwwwh · project thread
Docs only. Adds one sentence to the Kiota bullet in
packages/downgrader/README.md.In 3.0, a
$refwith siblings becomes{ ...siblings, allOf: [{ $ref }] }. Kiota 1.36.1 drops aoneOforanyOfbranch with that shape. The wrapper on its own is fine, and so is a bare$refbranch. Checked withkiota generate -l CSharp:oneOf [{ description, allOf: [$ref A] }, null branch]anyOf [{ description, $ref A }, { type: null }]A?anyOf [{ description, allOf: [$ref A] }, { description, allOf: [$ref B] }]UntypedNode$refbesidedescriptiononeOf [{ description, allOf: [$ref A] }, $ref B]Bonly{ description, allOf: [$ref A] }aloneAoRPC with Zod 4 writes the first shape for
A.describe('the a').nullable()whenAhas 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 checkpasses.Generated by Claude Code