Skip to content

Commit 1e130fb

Browse files
📝 Add docstrings to fixes-improvements
Docstrings generation was requested by @kthehatter. * #13 (comment) The following files were modified: * `validator/validator.go`
1 parent 5fa611b commit 1e130fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

validator/validator.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ type ValidationOption struct {
2727
Nested []ValidationOption // Validation options for nested objects
2828
}
2929

30-
// Validate checks the request body against the validation options and returns the first error.
30+
// Validate validates the request body based on the provided validation options.
31+
// It applies any transformers to update field values, enforces required fields,
32+
// and executes associated validators, returning the first error encountered.
33+
// For fields with nested validation options, it recursively validates the sub-objects.
3134
func Validate(body map[string]interface{}, options []ValidationOption) error {
3235
for _, option := range options {
3336
value, exists := body[option.Key]

0 commit comments

Comments
 (0)