Skip to content

fix(cli): deduplicate generated route methods - #1050

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
niteshseram:fix/route-gen-duplicate-methods
Dec 6, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
niteshseram:fix/route-gen-duplicate-methods

Conversation

@niteshseram

Copy link
Copy Markdown
Contributor

Summary

void gen route api/items --methods get,GET reports success but writes two GET exports. The generated file fails to load with SyntaxError: Identifier 'GET' has already been declared.

Deduplicate HTTP methods after trimming, lowercasing, and validating them. Keep the order of their first occurrence, so --methods get,GET,post generates one GET export followed by one POST export.

Tests

  • gen.test.ts runs the route generator with --methods get,GET,post and checks that the generated file exports exactly GET and POST in that order

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@cpojer
cpojer merged commit afc3dbe into voidzero-dev:main Dec 6, 2026
3 checks passed
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