Skip to content

docs(downgrader): note OpenAPI Generator merging a nullable string enum $ref - #81

Merged
dinwwwh merged 1 commit into
mainfrom
claude/project-thread-t85lyh
Oct 24, 2026
Merged

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

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 24, 2026

Copy link
Copy Markdown
Member

Requested by dinwwwh · project thread

Adds one line to the 3.1 → 3.0 Schema limitations in packages/downgrader/README.md.

OpenAPI Generator's default SIMPLIFY_ONEOF_ANYOF_ENUM normalizer merges the "null" branch from #72 ({ type: "string", nullable: true, enum: [null] }) beside a $ref to a string enum into a new inline enum, so the generated 3.0 client loses the referenced enum type. The null-branch shape stays as is, since every other shape tried breaks some other tool (oapi-codegen, datamodel-codegen, Ajv). The README now names the flag that keeps the reference: --openapi-normalizer SIMPLIFY_ONEOF_ANYOF_ENUM=false.

Docs only. pnpm run check passes.


Generated by Claude Code

…um `$ref`

OpenAPI Generator's default SIMPLIFY_ONEOF_ANYOF_ENUM normalizer merges
the `"null"` branch beside a `$ref` to a string enum into a new inline
enum, losing the reference. List it under the 3.1 to 3.0 Schema
limitations with the flag that keeps it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014n2RNMbadzMyFHr9E2AJou
@dinwwwh dinwwwh self-assigned this Oct 24, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 24, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at 9bcc822

Macroscope's review found this PR approvable — This PR adds one limitation/workaround note to the downgrader README and changes no executable code or configuration. It has no runtime or production-path impact.

You can add or adjust custom eligibility rules. Learn more.

@codecov

codecov Bot commented Oct 24, 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 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks


Comparing claude/project-thread-t85lyh (9bcc822) with main (7cd17bc)

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

  • packages/downgrader/README.md — adds one limitation bullet noting that OpenAPI Generator's default SIMPLIFY_ONEOF_ANYOF_ENUM normalizer merges the "null" branch beside a string-enum $ref into a new inline enum, losing the reference, and recommending --openapi-normalizer SIMPLIFY_ONEOF_ANYOF_ENUM=false to preserve it.

I checked the claim against upstream: .openapi-normalizer SIMPLIFY_ONEOF_ANYOF_ENUM is a real rule (default-on since 7.0.0), and in OpenAPINormalizer the enum-merge (processSimplifyAnyOfEnum, line 1384) runs before the null-stripping processSimplifyAnyOf (line 1406), so disabling it is indeed the flag that keeps the $ref. The documented null-branch shape matches what onlyNull() emits in packages/downgrader/src/v3.1-to-v3.0.ts:462. Flag syntax and bullet style match the surrounding docs.

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

@dinwwwh
dinwwwh merged commit d938fe6 into main Oct 24, 2026
11 checks passed
dinwwwh added a commit that referenced this pull request Oct 24, 2026
)

<!-- claude-projects-attribution: {"github_login":"dinwwwh"} -->
_Requested by **dinwwwh** · [project
thread](https://claude.ai/code/project/chan_01UcKMz91tMarPV1kWLVgLYE?thread=cmsg_01UcKMz91tMarPV1kWLVgLYEC8ii77bvJTYMXNpA7YYZXA)_

Adds one line to the 3.1 → 3.0 Schema limitations in
`packages/downgrader/README.md`, next to the OpenAPI Generator line from
#81.

Kiota 1.36 reads the `type: "string"` of the `"null"` branch (`{ type:
"string", nullable: true, enum: [null] }`, from #72 and #78) as a real
type. So from the 3.0 output, `z.array(User.nullable())` items and a
nullable union of several types come out as strings. Kiota also reads
3.1, which types them correctly.

The null-branch shape stays as is, since every other shape tried breaks
some other tool (an untyped or bare null shape fixes Kiota but breaks
Ajv or hey-api).

`pnpm run check` passes.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ABAx6Ud1HPRYdomPGUkrKG)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
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