Skip to content

fix: Ensure enums are at the top of the components to avoid issue on recursive schema parsing #1163

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 2 commits into from
Apr 14, 2025

Conversation

RoXuS
Copy link
Contributor

@RoXuS RoXuS commented Apr 7, 2025

The schema parser is recursive. When we parse the discriminators if the enums aren't yet parsed so they aren't used.

We have to be sure enums are at the top of the components list to ensure there are parsed before other components.

This fix #699.

Copy link

changeset-bot bot commented Apr 7, 2025

🦋 Changeset detected

Latest commit: bf95ad8

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

This PR includes changesets to release 1 package
Name Type
swagger-typescript-api 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

@RoXuS RoXuS force-pushed the enumAsFirst branch 4 times, most recently from 1657c8a to b9c0c0a Compare April 7, 2025 15:04
@smorimoto smorimoto added the bug Something isn't working label Apr 11, 2025
@smorimoto smorimoto requested a review from Copilot April 11, 2025 21:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 15 changed files in this pull request and generated no comments.

Files not reviewed (11)
  • tests/spec/discriminator/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/enumNamesAsValues/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/enumNotFirstInComponents/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/enumNotFirstInComponents/schema.json: Language not supported
  • tests/spec/enums-2.0/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/extractRequestBody/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/extractResponseBody/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/extractResponseError/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/moduleNameFirstTag/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/moduleNameIndex/snapshots/basic.test.ts.snap: Language not supported
  • tests/spec/unionEnums/snapshots/basic.test.ts.snap: Language not supported

@smorimoto smorimoto changed the title fix: Ensure enums are at the top of the components to avoid issue on … fix: Ensure enums are at the top of the components to avoid issue on recursive schema parsing Apr 14, 2025
smorimoto
smorimoto previously approved these changes Apr 14, 2025
_
Signed-off-by: Sora Morimoto <sora@morimoto.io>
@smorimoto smorimoto merged commit e477b58 into acacode:main Apr 14, 2025
1 check passed
@github-actions github-actions bot mentioned this pull request Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema order should not matter
2 participants