Commit Graph

15 Commits

Author SHA1 Message Date
takanuva15 f05f966a08
feat(form): Support default values for collections in form binding (#4048) 2024-09-21 23:24:18 +08:00
Ahmad Saeed Goda 28e57f58b1
fix(form): Set default value for form fields (#4047)
- Use specified default value in struct tags when binding a request input to struct for validation, even if sent empty, not only when not sent at all.
- Add string field to `TestMappingDefault` test case.
- Add test case for not sent form field to default to the value specified via code.
- Add test case for form field sent empty to default to the value specified via code.

Fixes: How to apply default value if empty value provided by client during model binding? #4042, #13042df, #a41721a
2024-09-06 13:21:19 +08:00
Jo YoHan 3cb30679b5
feat(form): add array collection format in form binding (#3986)
* feat(form): add array collection format in form binding

* feat(form): add array collection format in form binding

* test(form): fix test code for array collection format in form binding
2024-08-24 14:16:30 +08:00
Matthieu MOREL 5f55c6a711
ci(lint): enable testifylint linter (#4010)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-07-14 20:33:08 +08:00
bruceNu1l 24d67647cb
feat(form): add custom string slice for form tag unmarshal (#3970) (#3971)
Co-authored-by: Bruce Lee <admin@ifocusad.com>
2024-05-23 10:16:11 +08:00
dkkb a18219566c
feat(binding): Support custom BindUnmarshaler for binding. (#3933) 2024-05-07 09:43:15 +08:00
clearcode 3dc1cd6572
fix(binding): binding error while not upload file (#3819) (#3820)
Co-authored-by: zhangmj <zhangmj1@dustess.com>
2024-02-05 10:46:35 +08:00
Omkar P 44d0dd7092
fix: Add pointer support for url query params (#3659) (#3666)
The pointer support in url query params (using []*Struct for binding query params) was previously available in Gin, but was removed in commit 0d50ce8 since there wasn't a test case for such a scenario, and so the case block was removed as a redundant one.
2023-11-16 23:46:43 +08:00
hopehook 33ab0fc155
refactor(struct): Remove redundant type conversions (#3345) 2022-10-16 09:49:24 +08:00
thinkerou 2bde107686
test support go1.18 (#2990) 2022-03-21 09:43:17 +08:00
Matthieu MOREL 435a76b735
chore(ci): update dependencies (#2827)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2021-08-19 15:46:31 +08:00
voidman 690aa2b1b9
feat(binding): support custom struct tag (#2720)
* feat(binding): support custom struct tag

Add function `binding.MapFormWithTag` (#2719)

* doc: add 'bind form-data with custom struct tag'

Add 'Bind form-data request with custom struct and custom tag' section (#2719)

* test(binding): add test for MapFromWithTag
2021-06-30 00:53:56 +08:00
John Bampton cf8b583db4
Fix spelling (#2451) 2020-08-04 07:04:06 +08:00
Dmitry Kutakov db9174ae0c fix ignore walking on form mapping (#1942) (#1943) 2019-11-01 10:47:40 +08:00
Dmitry Kutakov 66d2c30c54 binding: move tests of mapping to separate test file (#1842)
* move tests of mapping to separate test file

make 100% coverage of form_mapping.go from form_mapping_test.go file

* fix tests for go 1.6

go 1.6 doesn't support `t.Run(...)` subtests
2019-05-07 19:06:55 +08:00