Skip to content

Releases: gookit/validate

v2.0.1

12 Jun 10:34

Choose a tag to compare

Change Log

Refactor

  • refactor(validators): 比较家族 RV 化搬入 internal/validators (RFC R1) d90d91c
  • refactor(validators): 标量类型族 IsInt/IsString/IsSlice RV 化搬入 internal (RFC R2a) 5a89ab1
  • refactor(validators): 长度族 Length/MinLength/MaxLength RV 化搬入 internal (RFC R2b) c69fc22
  • refactor(validators): 枚举族 Enum/NotIn RV 化搬入 internal (RFC R2c) d079b28
  • refactor(validators): 取串热路径复用载体 String() 消二次反射 (RFC R2d) aeab5ee
  • refactor(data): 提取 StructData.tryGetRV 取值原语,TryGet 委托 (RFC R4.1) 7352c7f
  • refactor(fieldval): Src 懒化 + IsEmpty/String/calcLen 纯 RV + required 载体原生 (RFC R4.2a) 7fbd721
  • refactor(validate): valueValidate 改吃载体 *FieldValue (RFC R4.2b-1) 64b2429

Feature

  • feat(validators): 公开 FieldCtx 接口 + funcMeta 识别 func(FieldCtx)bool 形态 (RFC R3a) bd98903
  • feat(validators): callValidatorValue 按 style 分派 + func(FieldCtx)bool 自定义校验器落地 (RFC R3b) 80805f9
  • feat(validate): struct 源只读校验入口(Validate/ValidateErr/E)自动跳过 safeData 收集 854da39

Update

  • perf(validators): IsBool/IsUint/IsArray/IsMap 提升进 switch + internal RV 版 (RFC R2.5a) db65592
  • perf(validators): Contains/NotContains 提升进 switch 免 reflect.Call (RFC R2.5b) e0351f4
  • perf(validate): 结构体源经 tryGetRV+NewRV 懒构造载体,CheckErr 去 2 装箱 (RFC R4.2b-2) 503863d
  • perf(validators): valueCompare 非指针分支纯 RV,消除 CheckErr 最后 1 装箱 (RFC R4.3) 95431c1
  • perf(validate): scRV 缓存字段 reflect.Value,免 skipCollect 重读并闭合非指针边界 b60f8be

Other

  • docs(perf): RFC validator 入参 RV 化 + FieldLevel 自定义校验器 5260449
  • docs(perf): RFC 命名定为 FieldCtx + 补开发交接(R1 首步) 17dd47f
  • docs(perf): RFC §8 修正 Src 懒装箱触发条件描述 63092bf
  • docs: 更新 RV-native 重构后压测数据与架构现状(CheckErr 0 alloc) c4088a0
  • docs(readme): CheckErr struct-valid 3→0 allocs(RV-native 端到端去装箱) 8f63bfa
  • chore: reanme and merge some go files 59e87c0
  • docs: 同步 struct 源 Validate/ValidateErr 自动免收集后的分配数字 1516f07

v2.0.0

08 Jun 05:33

Choose a tag to compare

Change Log

Refactor

  • refactor!: remove deprecated ValueLen (use reflects.Len) 06698ce
  • refactor(validate): use slices.Sort over sort.Strings (go1.21) c806920
  • refactor(rule): extract convertRuleArgs pure helper 127cf96
  • refactor(validators)!: unify Between to any params c0e43c6
  • refactor(validators): split validators.go by category into multiple files eab060a
  • refactor(validation): add resetForReuse for full per-validation state reset 3b2f205
  • refactor(internal): extract pure reflect helpers into internal/reflectx 01656c4
  • refactor(internal): move fieldValue into internal/fieldval 6dab9b8
  • refactor(util): replace hand-rolled helpers with goutil equivalents 406face

Fixed

  • fix(validators): avoid panic on non-string value for string validators 5f66d0d
  • fix(scene): empty-rule scene validates nothing (#314) d1031d6
  • fix(struct): nested *bool->false passes required, align with top-level (#217) da6eda7
  • fix(filter): apply filters per-element on interior wildcard path (#262) 6e600ed
  • fix(scene): match ".*" wildcard scene fields to slice-element rules (#283) 1fdb557
  • fix(validators): tighten fullUrl regex, reject invalid URLs (#138) e1e79ef

Feature

  • feat(register): support registering custom value types via AddCustomType e70bfa3
  • feat(factory): add opt-in pooled Validation factory (Struct/Map + Release) d2bdecd
  • feat(struct)!: cascade sub-struct validation only when parent field has a validate tag 5e71e41
  • feat(struct)!: exempt anonymous embedded structs from cascade gate 5075f05
  • feat(form): normalize bracket form keys to dot paths (#324 part 1/2) bbdad99
  • feat(bind): expand dot-path safeData into nested map (#324 part 2/2) a9c3fd3
  • feat(error): 新增 opt-in 开关 ErrShowValue 在错误消息追加触发值 9a6ea88
  • feat(message): #189 新增 StringMessage/StringMessages tag 写法声明字段消息 fc8c4cf
  • feat(validator): #292 新增规则级"逻辑或"校验器 rule_one_of 6bd2fcc
  • feat(validator): 新增 isActiveURL 校验 URL 是否可访问/活跃 b994b7a

Update

  • perf(rule): pre-convert static template args at build time 7a56656
  • perf(rule): share immutable args for pre-converted rules 2690940
  • perf(rule): share immutable argsReady rules instead of cloning per instance 7c643bd

Other

  • docs(plan): add v2.0 breaking-change implementation plan 80a047e
  • docs(plan): refine V3 — drop runtime convertArgsType via build-time arg conversion 723d352
  • docs(plan): mark V0 guardrail complete — golden/full/race/vet green 33d899d
  • chore(deps)!: bump go to 1.21, update CI matrix and dev sdk pin 4f4d5dc
  • docs(plan): mark V1 complete (go 1.21 + slices.Sort) 616d70d
  • docs(plan): mark V3 complete — build-time arg pre-conversion (5 commits) c4144d1
  • docs(plan): record validators.go split (1298->570, 4 files) 2c4ff08
  • docs(plan): rename phases V0..V8 to T0..T8 to avoid version confusion e9e7bae
  • docs(plan): redefine T4 to share immutable rules (drop DataFace design) 945d621
  • docs(plan): draft T5 custom-type API + add optional T9 internal migration 903f9c3
  • docs(plan): mark T5 complete (AddCustomType, zero-overhead gate) ea9b175
  • docs(plan): mark T6 complete (opt-in Factory/Pool, reuse 11 allocs) 7693ac9
  • docs(plan): mark T9 done (reflectx+fieldval slice; meta/exec stay) a4aa5fe
  • chore(mod)!: move module path to github.com/gookit/validate/v2 ff56235
  • docs(plan): mark T7 done (/v2 module path) 0301432
  • test(register): cover AddCustomType nil-sample guard branch 1b223aa
  • docs(v2.0): add upgrade guide and changelog 49cce3c
  • docs(readme): update import paths to /v2 6cd5054
  • docs(v2.0): archive final benchmarks feed771
  • docs(plan): mark T8 done + v2.0 plan complete (T0-T9) 17356a3
  • chore: move v1.6.0 bench file to subdir 83f20dc
  • test: migrate assert gookit testutil/assert to x/assert dd483da
  • test: mark nested fixtures with validate tag for cascade 9498aeb
  • docs(v2.0): document sub-struct cascade behavior change 6b70746
  • docs(v2.0): clarify anonymous embedded structs are exempt from cascade gate 7c847ec
  • docs(plan): record T10 sub-struct cascade gating (Java @Valid style) e43bd03
  • docs(readme): document sub-struct cascade, AddCustomType and NewFactory (v2.0) 830eff5
  • docs(readme): add missing built-in validators (numeric/intString/stringNumber/stringLength/pathExists/dirPath) 4d6ba50
  • test(issues): verify v2.0 resolution for #259/#217/#235/#232 d9364fc
  • test(issues): verify v2.0 resolution for #283/#314 e57a0a4
  • test(issues): verify v2.0 resolution for #327/#262 fdfd0e6
  • docs(issues): v2.0 issue review handoff (8 checked, 4 still-broken, backlog) 3d7807f
  • docs(issues): mark #314/#217 fixed, 2 still-broken remain (#283/#262) 266ec6d
  • docs(issues): design for #283/#262 wildcard path expansion 6af2e04
  • docs(issues): mark all 4 still-broken fixed (#314/#217/#262/#283) d07a91a
  • test(issues): verify v2.0 behavior for #138/#324 (both still-broken) 7d61cb9
  • docs(issues): record second-batch review of #138/#324 (both still-broken) d90c864
  • test(issues): verify v2.0 behavior for #277/#266/#265/#162 (question类) 94370b7
  • docs(issues): record review of #277/#266/#265/#162 (question类) h...
Read more

v1.6.0

03 Jun 14:46

Choose a tag to compare

Change Log

Refactor

  • refactor(meta): add cached type metadata + FieldByIndex access + cycle-safe build dcb0fd3
  • refactor(exec): split Rule.Apply/valueValidate into single-responsibility steps 069ad54

Fixed

  • fix(validators): handle pointer fields in RequiredIf (#334) (#335) ad5894a
  • fix(value): make Val/Var concurrency-safe via pooled validation 67292f0

Update

  • perf(fieldval): introduce fieldValue carrier to dedup reflect in validate path 11c889d
  • perf(rule): cache static-type rule templates; move rule collection to struct_rules.go 68d8a3d
  • perf(trans): share builtin messages instead of copying per Translator a153155
  • perf(validator): lazily build context validators (newEmpty 51->2 allocs) e703c6a
  • chore(changelog): group perf() commits and normalize quote style 43003ed

Other

  • build(deps): bump softprops/action-gh-release from 2 to 3 (#332) c4b782a
  • build(deps): bump github.com/gookit/goutil from 0.7.4 to 0.7.5 (#333) 436095c
  • build(deps): bump github.com/gookit/goutil from 0.7.5 to 0.7.6 (#336) 3c63bcb
  • chore: update some test and docs e5208d0
  • test: update a data source test 9af1437
  • docs: add v2 refactor design and v1.6.0 implementation plan e2f5d07
  • test(bench): add baseline benchmarks for v1.6.0 perf work c8d7479
  • test(compat): add golden regression test for rule collection 48e2746
  • docs(v1.6.0): changelog, TODO, final benchmarks and plan completion 2b18719
  • docs(design): reconcile v2-design with v1.6.0 as-built implementation 0a9f6ac
  • chore: drop stale pool/cache comments superseded by v1.6.0 25cdb2a

v1.5.7

31 Mar 09:54
d265741

Choose a tag to compare

What's Changed

  • feat: ensure consistent validation for multiple fields with ordered iteration by @almas-x in #313
  • fix: support escaped "|" in regex validation rules by @almas-x in #312
  • build(deps): bump github/codeql-action from 3 to 4 by @dependabot[bot] in #315
  • build(deps): bump golangci/golangci-lint-action from 8 to 9 by @dependabot[bot] in #317
  • fix: 内嵌类型为指针类型时,内嵌结构体字段的default无效 by @guihouchang in #319
  • build(deps): bump actions/checkout from 5 to 6 by @dependabot[bot] in #322
  • build(deps): bump github.com/gookit/goutil from 0.7.1 to 0.7.2 by @dependabot[bot] in #321
  • build(deps): bump github.com/gookit/goutil from 0.7.2 to 0.7.3 by @dependabot[bot] in #326
  • fix: 通配符规则验证 JSON 反序列化的切片时误判失败 by @devhaozi in #329
  • build(deps): bump github.com/gookit/goutil from 0.7.3 to 0.7.4 by @dependabot[bot] in #330
  • Fix ValidatePrivateFields: UpperFirst corrupts unexported embedded struct field paths by @Copilot in #331

New Contributors

Full Changelog: v1.5.6...v1.5.7

v1.5.6

06 Sep 07:47
89af7f9

Choose a tag to compare

Change Log

Fixed

  • fix: panic for named string type key in map (#298) 17116c7
  • fix: support validation of google/uuid.UUID type (#294) (#308) 306d343
  • fix: preserve nested JSON tag paths in error keys (#309) 74906af
  • fix: resolve eqField validation for pointer types in the validator (#310) dc0ed0c
  • fix: required rule fails for int/uint values equal to 0 (#311) 89af7f9

Feature

  • feat: add option to restore request body after reading (#307) aff7898

Other

  • Add comprehensive GitHub Copilot instructions for gookit/validate (#306) a96441d
  • ⬆️ dep: upgrade actions and deps to latest version 3dc6a3f
  • 🎨 chore: update some code styles, update git ignore config 0abf62c

What's Changed

  • Fix: prevent panic when using named string types as map keys by @RyabovNick in #298
  • Add comprehensive GitHub Copilot instructions for gookit/validate by @Copilot in #306
  • feat: add option to restore request body after reading by @almas-x in #307
  • fix: support validation of google/uuid.UUID type by @almas-x in #308
  • fix: preserve nested JSON tag paths in error keys by @almas-x in #309
  • fix: resolve eqField validation for pointer types in the validator by @almas-x in #310
  • fix: required rule fails for int/uint values equal to 0 by @almas-x in #311

New Contributors

  • @RyabovNick made their first contribution in #298
  • @Copilot made their first contribution in #306

Full Changelog: v1.5.5...v1.5.6

v1.5.5

27 May 13:38

Choose a tag to compare

Change Log

Feature

  • feat: support get data in custom validator (#285) dd6d136
  • feat: support validation of array values in URL query parameters (#287) 8f43fe3
  • feat: support multi multipart.FileHeader binding (#289) 3d8c39a
  • feat: support multi multipart.FileHeader binding (#293) 0393362

Other

  • build(deps): bump golangci/golangci-lint-action from 6 to 7 (#288) 8844616
  • build(deps): bump golangci/golangci-lint-action from 7 to 8 (#291) 20ea74a
  • 📝 style: modify some code style 8e7eaea
  • 📝 chore: update some code style and some comments 133c917
  • 📝 chore: update some code style and add some testcases 43de360

New Contributors

Full Changelog: v1.5.4...v1.5.5

v1.5.4

23 Dec 01:57

Choose a tag to compare

Change Log

Fixed

  • 🐛 fix: reflect: call of reflect.Value.IsNil on array Value. see #280 ced4035

Other

  • build(deps): bump github.com/gookit/filter from 1.2.1 to 1.2.2 (#279) d0e50a8

v1.5.3

11 Dec 15:36

Choose a tag to compare

Change Log

Update

  • 👔 up: update IsEmpty check func, add test case for issue 276 ba31b00
  • Fix: Prevent panic when validating struct with nil pointer to map field (#260) 1822f1e

Other

  • build(deps): bump golangci/golangci-lint-action from 3 to 4 (#258) 9ec448d
  • build(deps): bump softprops/action-gh-release from 1 to 2 (#261) 97a70f0
  • build(deps): bump golangci/golangci-lint-action from 4 to 5 (#263) 57c419f
  • build(deps): bump golangci/golangci-lint-action from 5 to 6 (#264) eda7946
  • [Doc] Add code example of how to use custom filters (#268) 82f315e
  • build(deps): bump github.com/gookit/goutil from 0.6.15 to 0.6.18 (#278) d6a88b1
  • ci: add ci test on go1.22+ version c3621d4

New Contributors

Full Changelog: v1.5.2...v1.5.3

v1.5.2

24 Jan 11:18

Choose a tag to compare

Change Log

Fixed

  • 🐛 fix: panic occurs when passing nil in sub-slice. see issues #223 cf5c4c1
  • fix: Prevent panic on validating nil pointer to slice field (#252) (#253) 117b816
  • 🐛 fix: parse struct tag error on field is byte slice. issues #247 2042e0f
  • 🐛 fix: util convTypeByBaseKind support more basic type convert. issues #245 b24adf8
  • 🐛 fix: error when using custom filter with pointer to slice of strings. see #255 4491213

Feature

  • ✨ feat: add new validator: optional for resolve the issues #192 71857e7

Update

  • ✅ up: update requiredX validate logic, add more unit tests 050296c
  • 👔 up: update some code style and error message format logic 637f9df
  • 👔 up: update the error string format on only one error a567209

Other

  • build(deps): bump WillAbides/setup-go-faster from 1.8.0 to 1.9.0 (#226) b52053c
  • build(deps): bump WillAbides/setup-go-faster from 1.9.0 to 1.9.1 (#228) 61213fa
  • build(deps): bump WillAbides/setup-go-faster from 1.9.1 to 1.10.0 (#229) 64f1fe3
  • build(deps): bump actions/checkout from 3 to 4 (#233) 21c2c18
  • build(deps): bump WillAbides/setup-go-faster from 1.10.0 to 1.10.1 (#230) 80cf844
  • build(deps): bump WillAbides/setup-go-faster from 1.10.1 to 1.11.0 (#234) 82b2c54
  • Improve validation of pointer fields (#237) b4d96df
  • build(deps): bump WillAbides/setup-go-faster from 1.11.0 to 1.12.0 (#238) 12d5abb
  • build(deps): bump github.com/gookit/goutil from 0.6.12 to 0.6.14 (#243) aafe11f
  • Fix for Boolean Pointer Field Validation Error (#240) 8c4d6aa
  • build(deps): bump WillAbides/setup-go-faster from 1.12.0 to 1.13.0 (#249) c9a3e1a
  • build(deps): bump github/codeql-action from 2 to 3 (#251) cf7f910
  • ✅ test: add a test case for the issues #252 203d95f
  • ⬆️ dep: upgrade the deps to latest version e57b4eb
  • ✅ test: add a test case for the issues #246 372b694
  • ✅ test: add test case for issues #250 ab0111b
  • 💚 ci: fix go-version value error on go.yaml lint job af6f358
  • build(deps): bump WillAbides/setup-go-faster from 1.13.0 to 1.14.0 (#256) 46c37da
  • 📝 doc: update some code comment info 27b33f1

v1.5.1

01 Aug 14:12

Choose a tag to compare

Change Log

Fixed

  • 🐛 fix: resolve the slice sub item convert type fail. issues #206 18b0e03
  • 🐛 fix: call of reflect.Value.Interface on zero Value. issues #223 3142ae2

Update

  • 👔 up: enhanced support multi level slice item value check. see issues #221 0e59d42
  • 👔 up: update some logic for create new validation, format some codes 66dd220
  • ⚡ up: performance apply the "required" validator b074012

Other

  • ✅ test: add more assert check for test issues #213 a142ed7