From d3de366d9a2efa5242ab99be56103bcbd7797f5d Mon Sep 17 00:00:00 2001 From: sdghchj Date: Wed, 11 Dec 2024 18:47:16 +0800 Subject: [PATCH] fix tests --- operation_test.go | 1 + parser_test.go | 9 ++++++--- testdata/generics_basic/expected.json | 12 ++++++++---- testdata/generics_names/expected.json | 3 ++- testdata/generics_property/expected.json | 6 ++++-- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/operation_test.go b/operation_test.go index 0e24d6c9d..aa77a8325 100644 --- a/operation_test.go +++ b/operation_test.go @@ -1619,6 +1619,7 @@ func TestParseParamCommentByFormDataTypeUint64(t *testing.T) { expected := `[ { "type": "integer", + "format": "int64", "description": "this is a test file", "name": "file", "in": "formData", diff --git a/parser_test.go b/parser_test.go index f0ca3b9c4..777d411f7 100644 --- a/parser_test.go +++ b/parser_test.go @@ -1332,7 +1332,8 @@ func TestParseSimpleApi_ForSnakecase(t *testing.T) { "type": "integer" }, "err": { - "type": "integer" + "type": "integer", + "format": "int32" }, "status": { "type": "boolean" @@ -1788,7 +1789,8 @@ func TestParseSimpleApi_ForLowerCamelcase(t *testing.T) { "type": "integer" }, "err": { - "type": "integer" + "type": "integer", + "format": "int32" }, "status": { "type": "boolean" @@ -1947,7 +1949,8 @@ func TestParseStructComment(t *testing.T) { }, "errorNo": { "description": "Error ` + "`" + `number` + "`" + ` tick comment", - "type": "integer" + "type": "integer", + "format": "int64" } } } diff --git a/testdata/generics_basic/expected.json b/testdata/generics_basic/expected.json index 58689cf74..4dc8819c8 100644 --- a/testdata/generics_basic/expected.json +++ b/testdata/generics_basic/expected.json @@ -354,7 +354,8 @@ "originMapField": { "type": "object", "additionalProperties": { - "type": "number" + "type": "number", + "format": "float64" } } } @@ -362,7 +363,8 @@ "types.MapField-string-float64": { "type": "object", "additionalProperties": { - "type": "number" + "type": "number", + "format": "float64" } }, "types.MapFieldNestedStruct-string": { @@ -375,7 +377,8 @@ "type": "object", "properties": { "f": { - "type": "number" + "type": "number", + "format": "float64" }, "s": { "type": "string" @@ -431,7 +434,8 @@ }, "errorNo": { "description": "Error `number` tick comment", - "type": "integer" + "type": "integer", + "format": "int64" } } }, diff --git a/testdata/generics_names/expected.json b/testdata/generics_names/expected.json index 5da1de542..e363892df 100644 --- a/testdata/generics_names/expected.json +++ b/testdata/generics_names/expected.json @@ -304,7 +304,8 @@ }, "errorNo": { "description": "Error `number` tick comment", - "type": "integer" + "type": "integer", + "format": "int64" } } }, diff --git a/testdata/generics_property/expected.json b/testdata/generics_property/expected.json index fe67258a1..7d8858f20 100644 --- a/testdata/generics_property/expected.json +++ b/testdata/generics_property/expected.json @@ -153,7 +153,8 @@ } }, "items2": { - "type": "integer" + "type": "integer", + "format": "int32" }, "post": { "$ref": "#/definitions/types.Field-array_types_Post" @@ -444,7 +445,8 @@ } }, "items2": { - "type": "integer" + "type": "integer", + "format": "int32" } } }