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: Duplicate path parameters #829

Merged
merged 7 commits into from Nov 28, 2020
Merged

Conversation

jackey8616
Copy link
Collaborator

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you written unit tests?
  • Have you written unit tests that cover the negative cases (i.e.: if bad data is submitted, does the library respond properly)?
  • This PR is associated with an existing issue?

Closing issues

Closes #748

Add metadataGenerator#checkForPathParamSignatureDuplicates to examine
duplicate path parameter define in same method.
Add test controller & unit test.
Refactor routeDuplicates.spec.ts to fit both duplicate route and path
parameter.
Add two and three duplication in DuplicatePathParamTestController.
Beautify output of error message.
refactor some test controller's route with same prefix, path param.
update expect in spec.ts.
Add cases for `:` in route parameter.
Add cases for positional detect cases.
Add warning log when partial route duplicates.
@jackey8616
Copy link
Collaborator Author

@WoH
Thank you! I did forget to handle /:id.

I also add a warn log when some partial route is duplicate like:

a/b/{c}
a/b

more test cases also added.

@jackey8616 jackey8616 requested a review from WoH November 18, 2020 19:19
Add function enum to make method return value more readable.
Rename _examinePaths method 's parameter for readability.
Lint codes with prettier.
@jackey8616 jackey8616 requested a review from WoH November 28, 2020 13:53
@WoH WoH merged commit 42f023b into lukeautry:master Nov 28, 2020
@jackey8616 jackey8616 deleted the FixDupPathParams branch November 28, 2020 17:30
@calvinwyoung
Copy link

Is there a way to disable the warnings generated by PARTIAL_TESTER_PATH_IS_SUBJECT_PREFIX and PARTIAL_SUBJECT_PATH_IS_TESTER_PREFIX? Some applications might purposely want to use many routes with similar prefixes. This change will cause the output logs to get pretty cluttered.

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.

Duplicate paths allowed with different path params
4 participants