Skip to content

Conversation

drwpow
Copy link
Contributor

@drwpow drwpow commented Aug 2, 2024

Changes

Fixes #1732, #1737, and other related issues mentioning this behavior. Removes the | undefined from the additionalProperties union that is a behavior change from 6.x.

How to Review

  • Tests updated; tests should pass (fortunately, though this is a far-reaching change, this is extremely well-tested!

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

@drwpow drwpow requested a review from a team as a code owner August 2, 2024 02:46
Copy link

changeset-bot bot commented Aug 2, 2024

🦋 Changeset detected

Latest commit: 4e0f0cf

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 Minor

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

@drwpow drwpow changed the title Remove undefined from additionalProperties Remove undefined from additionalProperties union Aug 2, 2024
@drwpow drwpow force-pushed the addl-properties-no-undef branch from ef03c56 to 104bd62 Compare August 2, 2024 02:48
Copy link

cloudflare-workers-and-pages bot commented Aug 2, 2024

Deploying openapi-ts with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4e0f0cf
Status: ✅  Deploy successful!
Preview URL: https://7998dd1d.openapi-ts.pages.dev
Branch Preview URL: https://addl-properties-no-undef.openapi-ts.pages.dev

View logs

@drwpow drwpow force-pushed the addl-properties-no-undef branch 2 times, most recently from 817a603 to ed1dcbf Compare August 2, 2024 03:59
property?: boolean;
[key: string]: string | undefined;
} & {
[key: string]: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this intersection seems a little awkward, but is necessary for TypeScript to work properly in most cases (here, you’d get some error like “property string not assignable to type boolean | undefined”).

@drwpow drwpow force-pushed the addl-properties-no-undef branch 2 times, most recently from ec58bc9 to 747f69c Compare August 2, 2024 04:03
@drwpow drwpow force-pushed the addl-properties-no-undef branch from 747f69c to 4e0f0cf Compare August 2, 2024 04:05
@drwpow drwpow merged commit 9939b76 into main Aug 2, 2024
@drwpow drwpow deleted the addl-properties-no-undef branch August 2, 2024 04:07
@github-actions github-actions bot mentioned this pull request Aug 2, 2024
ut0xygen pushed a commit to ut0xygen/openapi-typescript that referenced this pull request Aug 5, 2025
* Remove undefined from additionalProperties

* Add missing schema to update:examples script
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.

str:str dictionary generates str:str|undefined dictionary in v7.0.0
1 participant