-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
support validation for DocumentKey #467
support validation for DocumentKey #467
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution and congratulations on your first PR. 🍻
I leave a few questions.
It seems that there are duplicate codes with validation.go, how should we solve it?
ci build test runner is different to local test runner. There are no errro in local test runner. For example last ci build has a test error. It is a Why it happened? |
Codecov Report
@@ Coverage Diff @@
## main #467 +/- ##
==========================================
- Coverage 46.64% 46.49% -0.15%
==========================================
Files 69 69
Lines 5765 5790 +25
==========================================
+ Hits 2689 2692 +3
- Misses 2771 2789 +18
- Partials 305 309 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
New validator err := validation.ValidateDynamically(k.String(), []any{
"required",
"slug",
"min=4",
"max=30",
validation.CustomRule{
Func: func(fl validator.FieldLevel) bool {
return fl.Field().String()[0] == '$'
},
},
})
if err != nil {
return ErrInvalidKey
} |
We use You can find more information about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
It would be nice to just clean up the minor code styles and then merge them.
Sorry for the confusion. I was mistaken and thought it was just a matter of resolving conflicts and merging them. 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. 👍
Now we have a validation module.
Co-authored-by: Youngteac Hong <[email protected]>
Co-authored-by: Youngteac Hong <[email protected]>
Co-authored-by: Youngteac Hong <[email protected]>
Users can express data information using keys. The 30-character key limit was too short, so I increased it to 120 characters. |
What this PR does / why we need it:
The document key
must be valid
because it must be usable as thepath segment
of theurl
.Which issue(s) this PR fixes:
Fixes #457
Special notes for your reviewer:
^[a-z0-9\-._~]+$
)Does this PR introduce a user-facing change?:
Additional documentation:
Checklist: