Skip to content
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

fix: Fix pascal enum reference #219

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sschw
Copy link

@sschw sschw commented Feb 8, 2024

Generating enums using the useEnums option will generate the enum types with pascal(name), however when referencing the enum type, the name is not formatted.

This causes issues with lowerCamelCase names.

Wrapping name || "" inside a pascal solves issues with lowerCamelCase names.

@fabien0102
Copy link
Owner

Can you add a unit test to demonstrate the issue? I'm not sure I see what you are fixing 🤔

@sschw sschw force-pushed the fix-enum-pascal-formatting branch 2 times, most recently from 476734d to 5438b41 Compare February 19, 2024 10:47
@sschw
Copy link
Author

sschw commented Feb 19, 2024

Sure, I added a test to schemaToTypeAliasDeclaration.test.ts.
It can easily be tested by changing "Test" to "test" in the printSchema function in schemaToEnumDeclaration.test.ts and schemaToTypeAliasDeclaration.test.ts.
While schemaToEnumDeclaration is still working as intended, the enum tests in schemaToTypeAliasDeclaration was failing.

I also added a test to schemaToEnumDeclaration.test.ts, just so that this case is tested there as well.

@sschw sschw force-pushed the fix-enum-pascal-formatting branch from 5438b41 to 056474e Compare April 30, 2024 11:35
@sschw sschw force-pushed the fix-enum-pascal-formatting branch from 056474e to 5fdc8b2 Compare April 30, 2024 11:37
@sschw
Copy link
Author

sschw commented May 6, 2024

@fabien0102 Rebased this PR and solved the conflicts as jest update changed the snapshots.

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.

None yet

2 participants