Repository: gin-gonic/gin
Pull request #4289 (2025-07-08 00:30:08)

chore(deps): bump github.com/go-playground/validator/v10 from 10.26.0 to 10.27.0
Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.26.0 to 10.27.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/go-playground/validator/releases">github.com/go-playground/validator/v10's releases</a>.</em></p>
<blockquote>
<h2>Release 10.27.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix Release version badge on README page by <a href="https://github.com/nodivbyzero"><code>@​nodivbyzero</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1406">go-playground/validator#1406</a></li>
<li>fix russian E.164 error message by <a href="https://github.com/prigornitskiy"><code>@​prigornitskiy</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1349">go-playground/validator#1349</a></li>
<li>chore: remove unnecessary statement by <a href="https://github.com/qshuai"><code>@​qshuai</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1200">go-playground/validator#1200</a></li>
<li>Re-enable several linters by <a href="https://github.com/nodivbyzero"><code>@​nodivbyzero</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1412">go-playground/validator#1412</a></li>
<li>add support to tag validateFn by <a href="https://github.com/peczenyj"><code>@​peczenyj</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1363">go-playground/validator#1363</a></li>
<li>Bump golang.org/x/crypto from 0.33.0 to 0.35.0 in /_examples/validate_fn by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1418">go-playground/validator#1418</a></li>
<li>Bump golang.org/x/net from 0.34.0 to 0.38.0 in /_examples/validate_fn by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1419">go-playground/validator#1419</a></li>
<li>Align required_without with the contract stated in the documentation by <a href="https://github.com/jmfrees"><code>@​jmfrees</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1422">go-playground/validator#1422</a></li>
<li>Add translation example by <a href="https://github.com/cxlblm"><code>@​cxlblm</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1394">go-playground/validator#1394</a></li>
<li>doc(errors): mention RegisterTagNameFunc for FieldError.Field by <a href="https://github.com/khan-ajamal"><code>@​khan-ajamal</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1358">go-playground/validator#1358</a></li>
<li>Bump golangci/golangci-lint-action from 7 to 8 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1425">go-playground/validator#1425</a></li>
<li>feat(translation): add en translation for urn_rfc2141 by <a href="https://github.com/ryanmalesic"><code>@​ryanmalesic</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1431">go-playground/validator#1431</a></li>
<li>fix: panics when private field is validated by <a href="https://github.com/ykalchevskiy"><code>@​ykalchevskiy</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1423">go-playground/validator#1423</a></li>
<li>Fix: support validation for map values with struct types by <a href="https://github.com/JunaidIslam2105"><code>@​JunaidIslam2105</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1433">go-playground/validator#1433</a></li>
<li>Omitzero does not work with slice and map bug by <a href="https://github.com/JunaidIslam2105"><code>@​JunaidIslam2105</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1436">go-playground/validator#1436</a></li>
<li>Fix: Validator panics when 'nil' is used along with required if for slices and maps by <a href="https://github.com/JunaidIslam2105"><code>@​JunaidIslam2105</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1442">go-playground/validator#1442</a></li>
<li>docs: typos by <a href="https://github.com/eqsdxr"><code>@​eqsdxr</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1440">go-playground/validator#1440</a></li>
<li>fix: make &quot;file://&quot; fail <code>url</code> validation by <a href="https://github.com/bfabio"><code>@​bfabio</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1444">go-playground/validator#1444</a></li>
<li>disable way too aggressive and disagreeable linters by <a href="https://github.com/deankarn"><code>@​deankarn</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1445">go-playground/validator#1445</a></li>
<li>use golangci lint file for disables by <a href="https://github.com/deankarn"><code>@​deankarn</code></a> in <a href="https://redirect.github.com/go-playground/validator/pull/1447">go-playground/validator#1447</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/prigornitskiy"><code>@​prigornitskiy</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1349">go-playground/validator#1349</a></li>
<li><a href="https://github.com/qshuai"><code>@​qshuai</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1200">go-playground/validator#1200</a></li>
<li><a href="https://github.com/peczenyj"><code>@​peczenyj</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1363">go-playground/validator#1363</a></li>
<li><a href="https://github.com/jmfrees"><code>@​jmfrees</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1422">go-playground/validator#1422</a></li>
<li><a href="https://github.com/cxlblm"><code>@​cxlblm</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1394">go-playground/validator#1394</a></li>
<li><a href="https://github.com/khan-ajamal"><code>@​khan-ajamal</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1358">go-playground/validator#1358</a></li>
<li><a href="https://github.com/ryanmalesic"><code>@​ryanmalesic</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1431">go-playground/validator#1431</a></li>
<li><a href="https://github.com/ykalchevskiy"><code>@​ykalchevskiy</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1423">go-playground/validator#1423</a></li>
<li><a href="https://github.com/JunaidIslam2105"><code>@​JunaidIslam2105</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1433">go-playground/validator#1433</a></li>
<li><a href="https://github.com/eqsdxr"><code>@​eqsdxr</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1440">go-playground/validator#1440</a></li>
<li><a href="https://github.com/bfabio"><code>@​bfabio</code></a> made their first contribution in <a href="https://redirect.github.com/go-playground/validator/pull/1444">go-playground/validator#1444</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/go-playground/validator/compare/v10.26.0...v10.27.0">https://github.com/go-playground/validator/compare/v10.26.0...v10.27.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/go-playground/validator/commit/bc77d03bfbd951ad1299267754e230b0af36a5aa"><code>bc77d03</code></a> use golangci lint file for disables (<a href="https://redirect.github.com/go-playground/validator/issues/1447">#1447</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/4a1bc2f2628506a2cab2e3fe88d0cb57ccedbb6a"><code>4a1bc2f</code></a> disable way too aggressive and disagreeable linters (<a href="https://redirect.github.com/go-playground/validator/issues/1445">#1445</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/cf2267f30e617916a42e6217cd5d3c837100b374"><code>cf2267f</code></a> fix: make &quot;file://&quot; fail <code>url</code> validation (<a href="https://redirect.github.com/go-playground/validator/issues/1444">#1444</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/3fd4678e4a0346d57ac1ebcb81ceb86a87ed59f0"><code>3fd4678</code></a> docs: typos (<a href="https://redirect.github.com/go-playground/validator/issues/1440">#1440</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/ec374ef02d93322f9d337c47678fbb45ac055323"><code>ec374ef</code></a> Fix: Validator panics when 'nil' is used along with required if for slices an...</li>
<li><a href="https://github.com/go-playground/validator/commit/0e3e2f997385102062275f226e825b4a109f4833"><code>0e3e2f9</code></a> Omitzero does not work with slice and map bug (<a href="https://redirect.github.com/go-playground/validator/issues/1436">#1436</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/dfc7ccd4d817cfd6f065273e37d83f7ae7815cce"><code>dfc7ccd</code></a> Fix: support validation for map values with struct types (<a href="https://redirect.github.com/go-playground/validator/issues/1433">#1433</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/5b9542b93487972cdfa75ed03ebe4286c3f44c01"><code>5b9542b</code></a> fix: panics when private field is validated (<a href="https://redirect.github.com/go-playground/validator/issues/1423">#1423</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/f9a5a1fa1e61028e09df895cd92dfd31673e245f"><code>f9a5a1f</code></a> feat(translation): add en translation for urn_rfc2141 (<a href="https://redirect.github.com/go-playground/validator/issues/1431">#1431</a>)</li>
<li><a href="https://github.com/go-playground/validator/commit/20f7df64bdd443294349535a5da244ad0b2af71a"><code>20f7df6</code></a> Bump golangci/golangci-lint-action from 7 to 8 (<a href="https://redirect.github.com/go-playground/validator/issues/1425">#1425</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/go-playground/validator/compare/v10.26.0...v10.27.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/go-playground/validator/v10&package-manager=go_modules&previous-version=10.26.0&new-version=10.27.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/context.go b/context.go
index bf12830..b184678 100644
--- a/context.go
+++ b/context.go
@@ -216,6 +216,14 @@ func (c *Context) AbortWithStatus(code int) {
 	c.Abort()
 }
 
+// AbortWithStatusJSON calls `Abort()` and then `PureJSON` internally.
+// This method stops the chain, writes the status code and return a JSON body without escaping.
+// It also sets the Content-Type as "application/json".
+func (c *Context) AbortWithStatusPureJSON(code int, jsonObj any) {
+	c.Abort()
+	c.PureJSON(code, jsonObj)
+}
+
 // AbortWithStatusJSON calls `Abort()` and then `JSON` internally.
 // This method stops the chain, writes the status code and return a JSON body.
 // It also sets the Content-Type as "application/json".
diff --git a/go.mod b/go.mod
index 1ee9d8b..386a03b 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.23.0
 require (
 	github.com/bytedance/sonic v1.13.2
 	github.com/gin-contrib/sse v1.1.0
-	github.com/go-playground/validator/v10 v10.26.0
+	github.com/go-playground/validator/v10 v10.27.0
 	github.com/goccy/go-json v0.10.2
 	github.com/goccy/go-yaml v1.18.0
 	github.com/json-iterator/go v1.1.12
@@ -14,7 +14,7 @@ require (
 	github.com/pelletier/go-toml/v2 v2.2.4
 	github.com/quic-go/quic-go v0.53.0
 	github.com/stretchr/testify v1.10.0
-	github.com/ugorji/go/codec v1.2.12
+	github.com/ugorji/go/codec v1.3.0
 	golang.org/x/net v0.41.0
 	google.golang.org/protobuf v1.36.6
 )
diff --git a/go.sum b/go.sum
index 979c20d..fa948c7 100644
--- a/go.sum
+++ b/go.sum
@@ -19,14 +19,14 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
 github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
 github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
 github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
-github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
-github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
+github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
+github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
 github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
 github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
 github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
 github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
-github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
-github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
+github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
 github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
@@ -61,8 +61,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
 github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
 github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
-github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
-github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
+github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
+github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
 go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
 go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
 golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=


Test patch:
diff --git a/context_test.go b/context_test.go
index fe3ccd6..74f0842 100644
--- a/context_test.go
+++ b/context_test.go
@@ -1680,6 +1680,32 @@ func TestContextAbortWithStatusJSON(t *testing.T) {
 	assert.JSONEq(t, "{\"foo\":\"fooValue\",\"bar\":\"barValue\"}", jsonStringBody)
 }
 
+func TestContextAbortWithStatusPureJSON(t *testing.T) {
+	w := httptest.NewRecorder()
+	c, _ := CreateTestContext(w)
+	c.index = 4
+
+	in := new(testJSONAbortMsg)
+	in.Bar = "barValue"
+	in.Foo = "fooValue"
+
+	c.AbortWithStatusPureJSON(http.StatusUnsupportedMediaType, in)
+
+	assert.Equal(t, abortIndex, c.index)
+	assert.Equal(t, http.StatusUnsupportedMediaType, c.Writer.Status())
+	assert.Equal(t, http.StatusUnsupportedMediaType, w.Code)
+	assert.True(t, c.IsAborted())
+
+	contentType := w.Header().Get("Content-Type")
+	assert.Equal(t, "application/json; charset=utf-8", contentType)
+
+	buf := new(bytes.Buffer)
+	_, err := buf.ReadFrom(w.Body)
+	require.NoError(t, err)
+	jsonStringBody := buf.String()
+	assert.JSONEq(t, "{\"foo\":\"fooValue\",\"bar\":\"barValue\"}", jsonStringBody)
+}
+
 func TestContextError(t *testing.T) {
 	c, _ := CreateTestContext(httptest.NewRecorder())
 	assert.Empty(t, c.Errors)