Skip to content

Fix empty string enum members with --enum#2812

Open
cyphercodes wants to merge 1 commit into
openapi-ts:mainfrom
cyphercodes:fix/empty-string-enum-member-2807
Open

Fix empty string enum members with --enum#2812
cyphercodes wants to merge 1 commit into
openapi-ts:mainfrom
cyphercodes:fix/empty-string-enum-member-2807

Conversation

@cyphercodes
Copy link
Copy Markdown

Changes

Fixes #2807.

When --enum encounters an empty string enum value, the enum member name is now emitted as a string-literal member ("" = "") instead of an empty identifier.

Added regression coverage for both the low-level tsEnum helper and a schema transform matching the reported query-parameter enum case.

How to Review

Check tsEnumMember() handling for empty member names and the new enum transform regression. The generated enum should be valid TypeScript:

export enum PathsTestGetParametersQueryType {
    "" = "",
    foo = "foo",
    bar = "bar"
}

Checklist

  • Unit tests updated
  • docs/ updated (not necessary)
  • pnpm run update:examples run (not applicable; no example snapshots changed)

@cyphercodes cyphercodes requested a review from a team as a code owner May 17, 2026 03:53
@cyphercodes cyphercodes requested a review from gzm0 May 17, 2026 03:53
@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

👷 Deploy request for openapi-ts pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit ad21cb2

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 17, 2026

🦋 Changeset detected

Latest commit: ad21cb2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openapi-typescript Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

--enum flag doesn't convert empty string enums correctly

1 participant