fix: unmarshal from number to string with incorrect error message (#3625)

This commit is contained in:
Kevin Wan
2023-10-15 10:06:00 +08:00
committed by GitHub
parent b731aa38af
commit 4f22034342
3 changed files with 15 additions and 5 deletions

View File

@@ -5490,7 +5490,7 @@ func TestUnmarshalerProcessFieldPrimitiveWithJSONNumber(t *testing.T) {
err := m.processFieldPrimitiveWithJSONNumber(fieldType, value.Elem(), v,
&fieldOptionsWithContext{}, "field")
assert.Error(t, err)
assert.Equal(t, `type mismatch for field "field", expect "string", actual "int"`, err.Error())
assert.Equal(t, `type mismatch for field "field", expect "string", actual "number"`, err.Error())
})
t.Run("right type", func(t *testing.T) {