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

helper/validation: add StringRuneCountBetween() and StringBytesBetween() instead StringLenBetween() #985

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ryodocx
Copy link

@ryodocx ryodocx commented Jun 19, 2022

Summary

  • In this PullRequest, add validator in order to count string length correctly.
  • Current, StringLenBetween() count byte length.
  • For example Japanese, 1 character mean 3 bytes in UTF-8.
    • Sometimes, improper validation implements in terraform-provider via this behavior

What's changes?

  • add StringRuneCountBetween() for validate number of characters
  • add StringBytesBetween() for validate number of bytes (it's just copy of StringLenBetween())
  • StringLenBetween() is to deprecated
  • add validation for parameters(min, max)
  • add test

Related issues

@ryodocx ryodocx requested a review from a team as a code owner June 19, 2022 15:21
@ryodocx
Copy link
Author

ryodocx commented Jul 17, 2022

@bflad Could you help this PR?

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.

1 participant