Skip to content

Commit 5bfbeb7

Browse files
committed
fix int type
1 parent 495184f commit 5bfbeb7

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

providers/openapi/schema/parse_xml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func parseValue(s string, ref *Schema) (interface{}, error) {
171171
if err != nil {
172172
return nil, fmt.Errorf("parse integer failed: %v", s)
173173
}
174-
return int32(val64), nil
174+
return val64, nil
175175
}
176176

177177
if t.IsNumber() {

providers/openapi/schema/parse_xml_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func TestUnmarshalXML(t *testing.T) {
161161
test: func(t *testing.T) {
162162
v, err := schema.UnmarshalXML(strings.NewReader("<year>2005</year>"), schematest.New("integer"))
163163
require.NoError(t, err)
164-
require.Equal(t, 2005, v)
164+
require.Equal(t, int64(2005), v)
165165
},
166166
},
167167
{
@@ -229,7 +229,7 @@ func TestUnmarshalXML(t *testing.T) {
229229
),
230230
))
231231
require.NoError(t, err)
232-
require.Equal(t, map[string]interface{}{"foo": 123, "yuh": "bar"}, v)
232+
require.Equal(t, map[string]interface{}{"foo": int64(123), "yuh": "bar"}, v)
233233
},
234234
},
235235
{
@@ -338,7 +338,7 @@ func TestUnmarshalXML(t *testing.T) {
338338
),
339339
)
340340
require.NoError(t, err)
341-
require.Equal(t, map[string]interface{}{"id": 15, "author": "J K. Rowling", "title": "Harry Potter", "smp": "https://example.com/schema"}, v)
341+
require.Equal(t, map[string]interface{}{"id": int64(15), "author": "J K. Rowling", "title": "Harry Potter", "smp": "https://example.com/schema"}, v)
342342
},
343343
},
344344
{
@@ -413,7 +413,7 @@ func TestUnmarshalXML_Old(t *testing.T) {
413413
schematest.WithProperty("author", schematest.New("string"))),
414414
test: func(t *testing.T, i interface{}, err error) {
415415
require.NoError(t, err)
416-
require.Equal(t, map[string]interface{}{"id": 0, "title": "foo", "author": "bar"}, i)
416+
require.Equal(t, map[string]interface{}{"id": int64(0), "title": "foo", "author": "bar"}, i)
417417
},
418418
},
419419
{
@@ -426,7 +426,7 @@ func TestUnmarshalXML_Old(t *testing.T) {
426426
schematest.WithProperty("author", schematest.New("string", schematest.WithXml(&schema.Xml{Name: "Author"})))),
427427
test: func(t *testing.T, i interface{}, err error) {
428428
require.NoError(t, err)
429-
require.Equal(t, map[string]interface{}{"id": 0, "title": "foo", "author": "bar"}, i)
429+
require.Equal(t, map[string]interface{}{"id": int64(0), "title": "foo", "author": "bar"}, i)
430430
},
431431
},
432432
}

0 commit comments

Comments
 (0)