Skip to content

Enum with Root Types Filtering Recursive Reference #2375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025

Conversation

ParkerVR
Copy link
Contributor

@ParkerVR ParkerVR commented Jul 14, 2025

Changes

Using the --enum and --root-types in combination causes recursive reference to enum types used in schemas, breaking the file.
A few issues related:

#2099
#2341

How to Review

A specific combination of flags causes recursive imports, marked as patch since it seems incredibly unlikely anyone could successfully use this output in a production system. Had a custom in my project and was trying to use the flags instead, but the combined behavior broke me. https://github.com/Equal-IQ/api-model/blob/e99585b6244ac814ea1044f62333474a5857c3b8/Containers/generate.js

Checklist

  • Unit tests updated (CJS Test is broken before and after my change, unrelated)
  • [] docs/ updated (if necessary) don't think any change is required, as this is a reasonable expected behavior
  • [] pnpm run update:examples run (only applicable for openapi-typescript) no changes required to these, since the combination is not used for them

@ParkerVR ParkerVR requested a review from a team as a code owner July 14, 2025 08:40
@ParkerVR ParkerVR requested a review from drwpow July 14, 2025 08:40
Copy link

netlify bot commented Jul 14, 2025

Deploy Preview for openapi-ts ready!

Name Link
🔨 Latest commit 3fabebe
🔍 Latest deploy log https://app.netlify.com/projects/openapi-ts/deploys/6876f465d299a00008c1e265
😎 Deploy Preview https://deploy-preview-2375--openapi-ts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

changeset-bot bot commented Jul 14, 2025

🦋 Changeset detected

Latest commit: 3fabebe

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

This PR includes changesets to release 2 packages
Name Type
openapi-typescript Patch
swr-openapi 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

ParkerVR added a commit to Equal-IQ/api-model that referenced this pull request Jul 14, 2025
@ParkerVR
Copy link
Contributor Author

I added some snapshot tests here since this change is a bit particular to CLI Flag Combination, though I guess it could be inlined instead like some of the other partial api spec examples. I'll leave it to maintainers to decide on that

@drwpow
Copy link
Contributor

drwpow commented Aug 11, 2025

I added some snapshot tests here since this change is a bit particular to CLI Flag Combination, though I guess it could be inlined instead like some of the other partial api spec examples. I'll leave it to maintainers to decide on that

All tests are great! My take is this is a maintainer concern shuffling tests around. Them just existing in a PR is all that matters, thank you!

Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

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

Great fix, and great tests! Thank you!

@drwpow drwpow merged commit 5be22d7 into openapi-ts:main Aug 11, 2025
11 checks passed
@openapi-ts-bot openapi-ts-bot mentioned this pull request Aug 11, 2025
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