Skip to content

feat(gin): validate the requests of gin - #66

Merged
Insei merged 3 commits into
mainfrom
feat/gin
Oct 19, 2026
Merged

Insei merged 3 commits into
mainfrom
feat/gin

Conversation

@Insei

@Insei Insei commented Oct 19, 2026

Copy link
Copy Markdown
Owner

The module github.com/insei/valigo/gin:

  • binding.Validator = vgin.New(v) — c.ShouldBindJSON and the other binding methods validate by valigo; slices element by element with the index in the location ([1].email), non-structs are skipped, as binding.StructValidator requires.
  • vgin.Validate(c, v, &req) validates with the languages of Accept-Language (gin passes no request to its validator).
  • The error is shared.Errors of feat(shared): Errors, the errors of a validation as one error #65, the page shows it written as problem details.

ci: the modules are listed once in scripts/modules.sh, the workflow and the scripts loop over it, so the next module (echo) is one word. 100% coverage, tests with a real gin engine.

Insei added 3 commits October 19, 2026 10:54
The module github.com/insei/valigo/gin: New is the
binding.StructValidator of gin, so the binding methods validate by
valigo, slices element by element; Validate validates with the
languages of the Accept-Language header of the request.
scripts/modules.sh lists the modules, the workflow, check-coverage.sh and
check-examples.sh loop over it; the gin module is added.
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark diff: 9dba248 → 4581eb8 (10 runs)

goos: linux
goarch: amd64
pkg: github.com/insei/valigo
cpu: AMD EPYC 7763 64-Core Processor                
           │  base.txt   │           head.txt            │
           │   sec/op    │   sec/op     vs base          │
Validate-4   232.0n ± 2%   232.3n ± 2%  ~ (p=0.468 n=10)

           │  base.txt  │            head.txt            │
           │    B/op    │    B/op     vs base            │
Validate-4   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

           │  base.txt  │            head.txt            │
           │ allocs/op  │ allocs/op   vs base            │
Validate-4   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

@Insei
Insei merged commit 4402219 into main Oct 19, 2026
6 checks passed
@Insei
Insei deleted the feat/gin branch October 19, 2026 07:57
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9dba248) to head (1a7c7d3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #66   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           33        34    +1     
  Lines         1063      1085   +22     
=========================================
+ Hits          1063      1085   +22     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants