fix: preserve trailing separators in key generation#5594
Conversation
- Keep trailing underscores and hyphens in key normalization\n- Add regression coverage for key regex acceptance of underscore and hyphen\n\nCo-Authored-By: Paperclip <[email protected]>
|
👋 Hi @markphelps! Thanks for your contribution to this project. It looks like one or more of your commits are missing a DCO (Developer Certificate of Origin) sign-off. The DCO is a simple way for you to certify that you have the right to submit this code under the project's license. How to fix this: # For future commits, use the -s flag
git commit -s -m "Your commit message"
# To sign off on existing commits in this PR
git rebase HEAD~$(git rev-list --count origin/v2..HEAD) --signoff
git push --force-with-leaseThe 📋 View the failing DCO check for more details For more information about the DCO, visit: https://developercertificate.org/ |
- Avoid stripping user-typed leading/trailing separators unless they were introduced by normalization\n- Preserve existing unsupported-character trimming behavior\n\nCo-Authored-By: Paperclip <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #5594 +/- ##
=======================================
Coverage 60.68% 60.68%
=======================================
Files 141 141
Lines 13998 13998
=======================================
Hits 8494 8494
Misses 4780 4780
Partials 724 724
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request improves the validation logic and key formatting utilities, and enhances their associated tests. The main focus is on supporting underscores and hyphens in keys, ensuring that punctuation is rejected, and preserving separator characters in generated keys.
Fixes: #5591
Validation improvements:
keyValidationto verify that keys with underscores and hyphens are accepted, and keys with punctuation are rejected.validation.test.tsto includekeyValidation.Key formatting enhancements:
stringAsKeyfunction to preserve leading and trailing underscores and hyphens, rather than trimming them.helpers.test.tsto confirm thatstringAsKeypreserves in-progress separator characters like underscores and hyphens.