@@ -75,51 +75,51 @@ function test(includeExampleData) {
7575 {
7676 input : '{"age": 46}' ,
7777 expected :
78- 'type AutoGenerated struct {\n\tAge int `json:"age"`\n}\n' ,
78+ 'type AutoGenerated struct {\n\tAge int8 `json:"age"`\n}\n' ,
7979 expectedWithExample :
80- 'type AutoGenerated struct {\n\tAge int `json:"age" example:"46"`\n}\n' ,
80+ 'type AutoGenerated struct {\n\tAge int8 `json:"age" example:"46"`\n}\n' ,
8181 } ,
8282 {
8383 input : '{"negativeFloat": -1.00}' ,
8484 expected :
85- 'type AutoGenerated struct {\n\tNegativeFloat float64 `json:"negativeFloat"`\n}\n' ,
85+ 'type AutoGenerated struct {\n\tNegativeFloat float32 `json:"negativeFloat"`\n}\n' ,
8686 expectedWithExample :
87- 'type AutoGenerated struct {\n\tNegativeFloat float64 `json:"negativeFloat" example:"-1.1"`\n}\n' ,
87+ 'type AutoGenerated struct {\n\tNegativeFloat float32 `json:"negativeFloat" example:"-1.1"`\n}\n' ,
8888 } ,
8989 {
9090 input : '{"zeroFloat": 0.00}' ,
9191 expected :
92- 'type AutoGenerated struct {\n\tZeroFloat float64 `json:"zeroFloat"`\n}\n' ,
92+ 'type AutoGenerated struct {\n\tZeroFloat float32 `json:"zeroFloat"`\n}\n' ,
9393 expectedWithExample :
94- 'type AutoGenerated struct {\n\tZeroFloat float64 `json:"zeroFloat" example:"0.1"`\n}\n' ,
94+ 'type AutoGenerated struct {\n\tZeroFloat float32 `json:"zeroFloat" example:"0.1"`\n}\n' ,
9595 } ,
9696 {
9797 input : '{"positiveFloat": 1.00}' ,
9898 expected :
99- 'type AutoGenerated struct {\n\tPositiveFloat float64 `json:"positiveFloat"`\n}\n' ,
99+ 'type AutoGenerated struct {\n\tPositiveFloat float32 `json:"positiveFloat"`\n}\n' ,
100100 expectedWithExample :
101- 'type AutoGenerated struct {\n\tPositiveFloat float64 `json:"positiveFloat" example:"1.1"`\n}\n' ,
101+ 'type AutoGenerated struct {\n\tPositiveFloat float32 `json:"positiveFloat" example:"1.1"`\n}\n' ,
102102 } ,
103103 {
104104 input : '{"negativeFloats": [-1.00, -2.00, -3.00]}' ,
105105 expected :
106- 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}\n' ,
106+ 'type AutoGenerated struct {\n\tNegativeFloats []float32 `json:"negativeFloats"`\n}\n' ,
107107 expectedWithExample :
108- 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}\n' ,
108+ 'type AutoGenerated struct {\n\tNegativeFloats []float32 `json:"negativeFloats"`\n}\n' ,
109109 } ,
110110 {
111111 input : '{"zeroFloats": [0.00, 0.00, 0.00]}' ,
112112 expected :
113- 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}\n' ,
113+ 'type AutoGenerated struct {\n\tZeroFloats []float32 `json:"zeroFloats"`\n}\n' ,
114114 expectedWithExample :
115- 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}\n' ,
115+ 'type AutoGenerated struct {\n\tZeroFloats []float32 `json:"zeroFloats"`\n}\n' ,
116116 } ,
117117 {
118118 input : '{"positiveFloats": [1.00, 2.00, 3.00]}' ,
119119 expected :
120- 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}\n' ,
120+ 'type AutoGenerated struct {\n\tPositiveFloats []float32 `json:"positiveFloats"`\n}\n' ,
121121 expectedWithExample :
122- 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}\n' ,
122+ 'type AutoGenerated struct {\n\tPositiveFloats []float32 `json:"positiveFloats"`\n}\n' ,
123123 } ,
124124 {
125125 input : '{"topLevel": { "secondLevel": "exampleDataHere"} }' ,
@@ -159,6 +159,7 @@ function testFiles() {
159159 const testCases = [
160160 "duplicate-top-level-structs" ,
161161 "double-nested-objects" ,
162+ "supported-number-types" ,
162163 ] ;
163164
164165 for ( const testCase of testCases ) {
0 commit comments